# Effect.Aff

- Package
- purescript-aff
- Repository
- purescript-contrib/purescript-aff

### #Aff Source

### #ParAff Source

`data ParAff :: Type -> Type`

Applicative for running parallel effects. Any `Aff`

can be coerced to a
`ParAff`

and back using the `Parallel`

class.

#### Instances

`Functor ParAff`

`Apply ParAff`

Runs effects in parallel, combining their results.

`Applicative ParAff`

`(Semigroup a) => Semigroup (ParAff a)`

`(Monoid a) => Monoid (ParAff a)`

`Alt ParAff`

Races effects in parallel. Returns the first successful result or the first error if all fail with an exception. Losing branches will be cancelled.

`Plus ParAff`

`Alternative ParAff`

`Parallel ParAff Aff`

### #Canceler Source

`newtype Canceler`

A cancellation effect for actions run via `makeAff`

. If a `Fiber`

is
killed, and an async action is pending, the canceler will be called to
clean it up.

#### Constructors

#### Instances

### #launchAff_ Source

`launchAff_ :: forall a. Aff a -> Effect Unit`

Forks an `Aff`

from an `Effect`

context, discarding the `Fiber`

.

### #launchSuspendedAff Source

`launchSuspendedAff :: forall a. Aff a -> Effect (Fiber a)`

Suspends an `Aff`

from an `Effect`

context, returning the `Fiber`

.

### #suspendAff Source

`suspendAff :: forall a. Aff a -> Aff (Fiber a)`

Suspends an `Aff`

from within a parent `Aff`

context, returning the `Fiber`

.
A suspended `Aff`

is not executed until a consumer observes the result
with `joinFiber`

.

### #invincible Source

`invincible :: forall a. Aff a -> Aff a`

Runs an effect such that it cannot be killed.

### #cancelWith Source

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

Attaches a custom `Canceler`

to an action. If the computation is canceled,
then the custom `Canceler`

will be run afterwards.

### #bracket Source

`bracket :: forall a b. Aff a -> (a -> Aff Unit) -> (a -> Aff b) -> Aff b`

Guarantees resource acquisition and cleanup. The first effect may acquire some resource, while the second will dispose of it. The third effect makes use of the resource. Disposal is always run last, regardless. Neither acquisition nor disposal may be cancelled and are guaranteed to run until they complete.

### #generalBracket Source

`generalBracket :: forall a b. Aff a -> BracketConditions a b -> (a -> Aff b) -> Aff b`

A general purpose bracket which lets you observe the status of the bracketed action. The bracketed action may have been killed with an exception, thrown an exception, or completed successfully.

### #nonCanceler Source

`nonCanceler :: Canceler`

A canceler which does not cancel anything.

### #fiberCanceler Source

`fiberCanceler :: forall a. Fiber a -> Canceler`

A canceler from a Fiber.

## Re-exports from **Control.**Monad.Error.Class

### #catchError Source

`catchError :: forall e m a. MonadError e m => m a -> (e -> m a) -> m a`

### #throwError Source

`throwError :: forall e m a. MonadThrow e m => e -> m a`

### #try Source

`try :: forall e m a. MonadError e m => m a -> m (Either e a)`

Return `Right`

if the given action succeeds, `Left`

if it throws.

## Re-exports from **Control.**Parallel.Class

### #sequential Source

`sequential :: forall f m. Parallel f m => f ~> m`

This instance is provided for compatibility.

`Aff`

is always stack-safe within a given fiber. This instance will just result in unnecessary bind overhead.