Module

Presto.Core.Types.Language.Flow

Package
purescript-presto
Repository
juspay/purescript-presto

#Authorization Source

#UIResult Source

type UIResult s = Either Error s

#Control Source

newtype Control s

Constructors

#ErrorHandler Source

#FlowMethodF Source

data FlowMethodF a s

Algebra of the Flow free language.

Constructors

#FlowMethod Source

type FlowMethod s a = FlowMethodF a s

#FlowWrapper Source

newtype FlowWrapper a

Constructors

#Flow Source

type Flow a = Free FlowWrapper a

Free monadic language for making flows.

#wrap Source

wrap :: forall s a. FlowMethodF a s -> Flow a

FlowWrapper for existential type.

#getS Source

getS :: Key -> Flow (Maybe String)

Gets some string from state by key

#setS Source

setS :: Key -> String -> Flow Unit

Puts a string value into state using key.

#loadS Source

loadS :: Key -> Flow (Maybe String)

Gets some string from localStorage by key

#saveS Source

saveS :: Key -> String -> Flow Unit

Puts a string value into the localStorage using key.

#withError Source

withError :: forall s err. (err -> String) -> Flow (Either err s) -> Flow s

Converts error to string and throws at runtime or returns result.

#suppress Source

suppress :: forall s err. Flow (Either err s) -> Flow Unit

Supresses error.

#throwErr Source

throwErr :: forall a. String -> Flow a

Throws error.

#runUI' Source

runUI' :: forall b a. Interact Error a b => a -> Flow (UIResult b)

Runs UI and returns result of user's interaction with a screen.

#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.

#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.

#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.

#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.

#callAPI Source

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

Call API being authorized.

#get Source

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

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

#set Source

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

Serializes a value and puts it into the state.

#fork Source

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

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

#launch Source

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

Forks a flow and returns a void control structure.

#doAff Source

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

Runs any Aff as part of the flow

#await Source

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

Awaits result from a forked flow.

#await' Source

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

Awaits a forked flow to be completed.

#delay Source

delay :: Milliseconds -> Flow Unit

Delays computation for a given number of milliseconds.

#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.

#save Source

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

Serializes a value and puts it into the local storage.

#checkPermissions Source

checkPermissions :: Array Permission -> Flow PermissionStatus

Checks if permissions granted.

#takePermissions Source

takePermissions :: Array Permission -> Flow (Array PermissionResponse)

Tries to aquire permissions.