Module

Control.Promise

#fromAff

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

Convert an Aff into a Promise.

#toAff

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'

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

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

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.

Modules