Module

Control.Promise

Package
purescript-aff-promise
Repository
nwolverson/purescript-aff-promise

#fromAff Source

fromAff :: forall a. Aff a -> Effect (Promise a)

Convert an Aff into a Promise.

#toAff Source

toAff :: forall a. Promise a -> Aff a

Convert a Promise into an Aff. When the promise rejects, we attempt to coerce the error value into an actual JavaScript Error object. We can do this with Error objects or Strings. Anything else gets a "dummy" Error object.

#toAff' Source

toAff' :: forall a. (Foreign -> Error) -> Promise a -> Aff a

Convert a Promise into an Aff with custom Error coercion. When the promise rejects, we attempt to coerce the error value into an actual JavaScript Error object using the provided function.

#toAffE Source

toAffE :: forall a. Effect (Promise a) -> Aff a

Utility to convert an Effect returning a Promise into an Aff (i.e. the inverse of fromAff)

#Promise Source

data Promise t0

Type of JavaScript Promises (with particular return type) Effects are not traced in the Promise type, as they form part of the Effect that results in the promise.