Module

Control.Parallel.Class

#Parallel

class Parallel :: (Type -> Type) -> (Type -> Type) -> Constraintclass (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

#ParCont

newtype ParCont :: (Type -> Type) -> Type -> Typenewtype 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

Modules