Module

Presto.Core.Flow

Package
purescript-presto
Repository
juspay/purescript-presto

Re-exports from Presto.Core.Language.Runtime.API

#APIRunner Source

type APIRunner = forall e. Request -> Aff e String

#runAPIInteraction Source

Re-exports from Presto.Core.Language.Runtime.Interpreter

#UIRunner Source

type UIRunner = forall e. String -> Aff (ui :: UI | e) String

#PermissionTakeRunner Source

#PermissionCheckRunner Source

type PermissionCheckRunner = forall e. Array Permission -> Aff (storage :: STORAGE | e) PermissionStatus

Re-exports from Presto.Core.Types.Language.Flow

#Flow Source

type Flow a = Free FlowWrapper a

Free monadic language for making flows.

#showUI Source

showUI :: forall b a. Interact Error a b => a -> Flow Unit

Runs UI and doesn't return anything useful (equivalent to void <<< runUI). Handles error in runtime.

#set Source

set :: forall s. Serializable s => Key -> s -> Flow Unit

Serializes a value and puts it into the state.

#save Source

save :: forall s. Serializable s => Key -> s -> Flow Unit

Serializes a value and puts it into the local storage.

#runUI Source

runUI :: forall b a. Interact Error a b => a -> Flow b

Runs UI and returns result of user's interaction with a screen. Handles error in runtime.

#oneOf Source

oneOf :: forall s. Array (Flow s) -> Flow s

Executes a set of actions and returns when the first one is done

#load Source

load :: forall s. Serializable s => Key -> Flow (Maybe s)

Gets some data from local storage and deserializes to s if possible.

#launch Source

launch :: Flow Unit -> Flow (Control Unit)

Forks a flow and returns a void control structure.

#get Source

get :: forall s. Serializable s => Key -> Flow (Maybe s)

Gets some data from state and deserializes to s if possible.

#forkUI Source

forkUI :: forall b a. Interact Error a b => a -> Flow Unit

Runs UI async, doesn't return anything useful. Handles error in runtime.

#fork Source

fork :: forall s. Flow s -> Flow (Control s)

Forks a flow and returns a control structure for getting results back (like Future).

#evalUI Source

evalUI :: forall s b a. Interact Error a b => a -> (b -> Either Error s) -> Flow s

Runs UI with a custom converter Handles error in runtime.

#doAff Source

doAff :: forall s. (forall eff. AppFlow eff s) -> Flow s

Runs any Aff as part of the flow

#delay Source

delay :: forall d. Duration d => d -> Flow Unit

Delays computation for the given amount of time.

#callAPI Source

callAPI :: forall b a. Encode a => Decode b => RestEndpoint a b => Headers -> a -> Flow (APIResult b)

Call API being authorized.

#await' Source

await' :: forall s. Control s -> Flow Unit

Awaits a forked flow to be completed.

#await Source

await :: forall s. Control s -> Flow s

Awaits result from a forked flow.

Re-exports from Presto.Core.Types.Language.Interaction

#Interaction Source

type Interaction s = Free InteractionF s

Free monadic Interaction type. Denotes a request-response interaction.

#Interact Source

class (Encode a, Decode b) <= Interact err a b | a -> b, b -> a

Represents a relation between types a (input type) and b (output type).

#defaultInteract Source

defaultInteract :: forall b a. Encode a => Decode b => a -> Interaction (Either Error b)

Re-exports from Presto.Core.Types.Language.Storage

#Key Source

type Key = String