Module

Dominator.Core.Cmd

Package
purescript-dominator-core
Repository
lazamar/purescript-dominator-core

#Cmd Source

type Cmd eff b = ContT Unit (Eff eff) b

A Cmd represents an asynchronous task to be executed.

The result of a Cmd will be sent to the update function so you can use it to modify your model.

#Cmds Source

type Cmds eff b = Array (Cmd eff b)

Dominator's update function should return an Array of Cmd. Cmds serve as a shorthand for that.

#makeCmd Source

makeCmd :: forall eff a. ((a -> Eff eff Unit) -> Eff eff Unit) -> Cmd eff a

Use makeCmd to use your effectful foreign function as a Cmd.

#fromAff Source

fromAff :: forall a eff. Aff eff a -> Cmd eff (Either Error a)

Transform an Aff directly into a Cmd. Because Aff may fail, you need to handle the possibility of Error.

#runAff Source

runAff :: forall msg a eff. (Error -> msg) -> (a -> msg) -> Aff eff a -> Cmd eff msg

Transform an Aff into a Cmd handling success and error in separate functions.