SuspensionHelper

class SuspensionHelper<A>(toSucceed: (A) -> Unit, toFail: (A_BasicObject) -> Unit)

A helper class for making fiber suspension syntax more articulate. It provides succeed and fail methods that client code can invoke.

Parameters

toSucceed

The function to call that accepts a value from the Primitive if the Primitive is successful.

toFail

The function to call that accepts an A_BasicObject that provides the reason for the Primitive failure.

Constructors

Link copied to clipboard
fun <A> SuspensionHelper(toSucceed: (A) -> Unit, toFail: (A_BasicObject) -> Unit)

Construct a SuspensionHelper.

Functions

Link copied to clipboard
fun fail(errorNumber: A_BasicObject)
fun fail(errorCode: AvailErrorCode)

Fail from the suspended Primitive, resuming its fiber.

Link copied to clipboard
fun succeed(value: A)

Succeed from the suspended Primitive, resuming its fiber.