# Control.Monad.Aff

- Package
- purescript-aff
- Repository
- slamdata/purescript-aff

### #Aff Source

`data Aff :: Row Effect -> Type -> Type`

An asynchronous computation with effects `e`

. The computation either
errors or produces a value of type `a`

.

This is moral equivalent of `ErrorT (ContT Unit (Eff e)) a`

.

#### Instances

`(Semigroup a) => Semigroup (Aff e a)`

`(Monoid a) => Monoid (Aff e a)`

`Functor (Aff e)`

`Apply (Aff e)`

`Applicative (Aff e)`

`Bind (Aff e)`

`Monad (Aff e)`

`MonadEff e (Aff e)`

`MonadThrow Error (Aff e)`

`MonadError Error (Aff e)`

Allows users to catch errors on the error channel of the asynchronous computation. See documentation in

`purescript-transformers`

.`Alt (Aff e)`

`Plus (Aff e)`

`Alternative (Aff e)`

`MonadZero (Aff e)`

`MonadPlus (Aff e)`

`MonadRec (Aff e)`

`Parallel (ParAff e) (Aff e)`

### #Canceler Source

`newtype Canceler e`

A canceler is an asynchronous function that can be used to attempt the cancelation of a computation. Returns a boolean flag indicating whether or not the cancellation was successful. Many computations may be composite, in such cases the flag indicates whether any part of the computation was successfully canceled. The flag should not be used for communication.

#### Constructors

#### Instances

### #cancelWith Source

`cancelWith :: forall a e. Aff e a -> Canceler e -> Aff e a`

This function allows you to attach a custom canceler to an asynchronous computation. If the computation is canceled, then the custom canceler will be run along side the computation's own canceler.

### #launchAff Source

`launchAff :: forall a e. Aff e a -> Eff (exception :: EXCEPTION | e) (Canceler e)`

Converts the asynchronous computation into a synchronous one. All values are ignored, and if the computation produces an error, it is thrown.

Catching exceptions by using `catchException`

with the resulting Eff
computation is not recommended, as exceptions may end up being thrown
asynchronously, in which case they cannot be caught.

If you do need to handle exceptions, you can use `runAff`

instead, or
you can handle the exception within the Aff computation, using
`catchError`

(or any of the other mechanisms).

### #makeAff' Source

`makeAff' :: forall a e. ((Error -> Eff e Unit) -> (a -> Eff e Unit) -> Eff e (Canceler e)) -> Aff e a`

Creates an asynchronous effect from a function that accepts error and success callbacks, and returns a canceler for the computation. This function can be used for asynchronous computations that can be canceled.

### #delay Source

`delay :: forall e. Milliseconds -> Aff e Unit`

Pauses execuation of the current computation for the specified number of milliseconds.

### #nonCanceler Source

`nonCanceler :: forall e. Canceler e`

A constant canceller that always returns false.

Allows users to throw errors on the error channel of the asynchronous computation. See documentation in

`purescript-transformers`

.