Module

Control.Monad.Promise

Package
purescript-promises
Repository
thimoteus/purescript-promises

#PurePromise Source

type PurePromise a = forall r. Promise r a

#promise Source

promise :: forall c a r. Deferred => ((a -> c) -> (Error -> c) -> c) -> Promise r a

#then' Source

then' :: forall b a r. Deferred => (a -> Promise r b) -> Promise r a -> Promise r b

#resolve Source

resolve :: forall a r. a -> Promise r a

#catch Source

catch :: forall a r. Deferred => Promise r a -> (Error -> Promise r a) -> Promise r a

#reject Source

reject :: forall b r. Deferred => Error -> Promise r b

#all Source

all :: forall a r g f. Deferred => Foldable f => Unfoldable g => f (Promise r a) -> Promise r (g a)

#race Source

race :: forall a r f. Deferred => Foldable f => f (Promise r a) -> Promise r a

Note that while promise semantics say that race xs resolves to the first x in xs to resolve, race xs won't terminate until each promise is settled. In addition, if Array.fromFoldable xs is [], race xs will never settle.

#delay Source

delay :: forall a r. Deferred => Milliseconds -> a -> Promise r a

#runPromise Source

runPromise :: forall b a eff. (a -> Eff eff b) -> (Error -> Eff eff b) -> (Deferred => Promise eff a) -> Eff eff Unit

Re-exports from Control.Monad.Promise.Unsafe

#Deferred Source

class Deferred