Module
Control.Parallel
- Package
- purescript-parallel
- Repository
- purescript/purescript-parallel
#parTraverse Source
parTraverse :: forall f m t a b. Parallel f m => Applicative f => Traversable t => (a -> m b) -> t a -> m (t b)Traverse a collection in parallel.
#parTraverse_ Source
parTraverse_ :: forall f m t a b. Parallel f m => Applicative f => Foldable t => (a -> m b) -> t a -> m UnitTraverse a collection in parallel, discarding any results.
#parSequence Source
parSequence :: forall a t m f. Parallel f m => Applicative f => Traversable t => t (m a) -> m (t a)#parSequence_ Source
parSequence_ :: forall a t m f. Parallel f m => Applicative f => Foldable t => t (m a) -> m Unit#parOneOf Source
parOneOf :: forall a t m f. Parallel f m => Alternative f => Foldable t => Functor t => t (m a) -> m aRace a collection in parallel.
#parOneOfMap Source
parOneOfMap :: forall a b t m f. Parallel f m => Alternative f => Foldable t => Functor t => (a -> m b) -> t a -> m bRace a collection in parallel while mapping to some effect.
Re-exports from Control.Parallel.Class
#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
Newtype (ParCont m a) _(MonadEffect m) => Functor (ParCont m)(MonadEffect m) => Apply (ParCont m)(MonadEffect m) => Applicative (ParCont m)(MonadEffect m) => Alt (ParCont m)(MonadEffect m) => Plus (ParCont m)(MonadEffect m) => Alternative (ParCont m)(MonadEffect m) => Parallel (ParCont m) (ContT Unit m)
#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
parallel :: m ~> fsequential :: f ~> m
Instances
(Parallel f m, Monad m) => Parallel (Compose f (Either e)) (ExceptT e m)(Parallel f m) => Parallel (ReaderT e f) (ReaderT e m)(Monoid w, Parallel f m) => Parallel (WriterT w f) (WriterT w m)(Parallel f m, Monad m) => Parallel (Compose f Maybe) (MaybeT m)(Parallel f m) => Parallel (Star f a) (Star m a)(Parallel f m) => Parallel (Costar f a) (Costar m a)(MonadEffect m) => Parallel (ParCont m) (ContT Unit m)