Module

Control.Parallel.Class

Package
purescript-parallel
Repository
purescript/purescript-parallel

#Parallel Source

class Parallel :: (Type -> Type) -> (Type -> Type) -> Constraintclass (Apply m, Apply f) <= Parallel f m | m -> f, f -> m where

The Parallel class abstracts over pairs of Applys where one of them (m) composes sequentially, and the other (f) composes in parallel. m is usually a Monad, which enforces the sequential nature of its composition, but it doesn't need to be.

Members

Instances

#ParCont Source

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