Module

Bonjiri

Package
purescript-bonjiri
Repository
justinwoo/purescript-bonjiri

#JSPromise Source

data JSPromise :: Type -> Type

Instances

#PromiseSpec Source

newtype PromiseSpec a

Constructors

Instances

#fromEffect Source

#mkPromiseSpec Source

mkPromiseSpec :: forall a. NotJSPromise a => ((a -> Effect Unit) -> (Foreign -> Effect Unit) -> Effect Unit) -> PromiseSpec a

#pure Source

pure :: forall a. NotJSPromise a => a -> PromiseSpec a

#run Source

run :: forall a. NotJSPromise a => (Foreign -> Effect Unit) -> (a -> Effect Unit) -> PromiseSpec a -> Effect Unit

takes onError, onSuccess, and a PromiseSpec to run a JSPromise onError uses Foreign, since any value can be returned from throw

#resolve Source

resolve :: forall a. NotJSPromise a => a -> Effect (JSPromise a)

create a JSPromise of a pure value in a thunk

#reject Source

reject :: Foreign -> Effect (JSPromise Void)

throw a JSPromise of a pure value in a thunk

#map Source

map :: forall b a. NotJSPromise b => (a -> b) -> PromiseSpec a -> PromiseSpec b

map the value in a promise spec

#chain Source

chain :: forall b a. NotJSPromise b => (a -> Effect (JSPromise b)) -> PromiseSpec a -> PromiseSpec b

Chain a promise spec

#catch Source

catch :: forall b a. NotJSPromise b => (a -> Effect (JSPromise b)) -> PromiseSpec a -> PromiseSpec b

Chain an error from a promise spec

#all Source

all :: forall a. NotJSPromise a => Array (PromiseSpec a) -> PromiseSpec (Array a)

Process all promise specs in an array

#apply Source

apply :: forall b a. NotJSPromise a => NotJSPromise b => PromiseSpec (a -> b) -> PromiseSpec a -> PromiseSpec b

apply a function to a value inside promise specs

#NotJSPromise Source

class NotJSPromise a 

Make sure we don't have JS promises nested

Instances

Modules
Bonjiri