Module

Control.Parallel

#parApply

parApply :: forall f m a b. Parallel f m => m (a -> b) -> m a -> m b

Apply a function to an argument under a type constructor in parallel.

#parTraverse

parTraverse :: forall f m t a b. Parallel f m => Traversable t => (a -> m b) -> t a -> m (t b)

Traverse a collection in parallel.

#parTraverse_

parTraverse_ :: forall f m t a b. Parallel f m => Foldable t => (a -> m b) -> t a -> m Unit

Traverse a collection in parallel, discarding any results.

#parSequence

parSequence :: forall a t m f. Parallel f m => Traversable t => t (m a) -> m (t a)

#parSequence_

parSequence_ :: forall a t m f. Parallel f m => Foldable t => t (m a) -> m Unit

#parOneOf

parOneOf :: forall a t m f. Parallel f m => Alternative f => Foldable t => Functor t => t (m a) -> m a

Race a collection in parallel.

#parOneOfMap

parOneOfMap :: forall a b t m f. Parallel f m => Alternative f => Foldable t => Functor t => (a -> m b) -> t a -> m b

Race a collection in parallel while mapping to some effect.

Re-exports from Control.Parallel.Class

#ParCont

newtype ParCont m a

The ParCont type constructor provides an Applicative instance based on ContT Unit m, which waits for multiple continuations to be resumed simultaneously.

ParCont sections of code can be embedded in sequential code by using the parallel and sequential functions:

loadModel :: ContT Unit (Eff (ajax :: AJAX)) Model
loadModel = do
  token <- authenticate
  sequential $
    Model <$> parallel (get "/products/popular/" token)
          <*> parallel (get "/categories/all" token)

Constructors

Instances

#Parallel

class (Monad m, Applicative f) <= Parallel f m | m -> f, f -> m where

The Parallel class abstracts over monads which support parallel composition via some related Applicative.

Members

Instances

Modules