remote-monad-0.1.0.0: An parametrizable Remote Monad, and parametrizable Applicative Functor

Copyright(C) 2016 The University of Kansas
LicenseBSD-style (see the file LICENSE)
MaintainerAndy Gill
StabilityAlpha
PortabilityGHC
Safe HaskellSafe
LanguageHaskell2010

Control.Remote.Monad

Contents

Description

 

Synopsis

The remote monad

data RemoteMonad c p a Source #

Instances

Monad (RemoteMonad c p) Source # 

Methods

(>>=) :: RemoteMonad c p a -> (a -> RemoteMonad c p b) -> RemoteMonad c p b #

(>>) :: RemoteMonad c p a -> RemoteMonad c p b -> RemoteMonad c p b #

return :: a -> RemoteMonad c p a #

fail :: String -> RemoteMonad c p a #

Functor (RemoteMonad c p) Source # 

Methods

fmap :: (a -> b) -> RemoteMonad c p a -> RemoteMonad c p b #

(<$) :: a -> RemoteMonad c p b -> RemoteMonad c p a #

Applicative (RemoteMonad c p) Source # 

Methods

pure :: a -> RemoteMonad c p a #

(<*>) :: RemoteMonad c p (a -> b) -> RemoteMonad c p a -> RemoteMonad c p b #

(*>) :: RemoteMonad c p a -> RemoteMonad c p b -> RemoteMonad c p b #

(<*) :: RemoteMonad c p a -> RemoteMonad c p b -> RemoteMonad c p a #

The primitive lift functions

command :: c -> RemoteMonad c p () Source #

promote a command into the remote monad

procedure :: p a -> RemoteMonad c p a Source #

promote a procedure into the remote monad

The run functions

runMonad :: (RunMonad f, Monad m) => (f c p ~> m) -> RemoteMonad c p ~> m Source #

This overloaded function chooses the best bundling strategy based on the type of the handler your provide.

runWeakMonad :: Monad m => (WeakPacket c p ~> m) -> RemoteMonad c p ~> m Source #

This is the classic weak remote monad, or technically the weak remote applicative weak remote monad.

runStrongMonad :: forall m c p. Monad m => (StrongPacket c p ~> m) -> RemoteMonad c p ~> m Source #

This is the classic strong remote monad. It bundles packets (of type StrongPacket) as large as possible, including over some monadic binds.

runApplicativeMonad :: forall m c p. Monad m => (ApplicativePacket c p ~> m) -> RemoteMonad c p ~> m Source #

The is the strong applicative strong remote monad. It bundles packets (of type RemoteApplicative) as large as possible, including over some monadic binds.

runMonadSkeleton :: Monad m => (RemoteApplicative c p ~> m) -> RemoteMonad c p ~> m Source #

This is a remote monad combinator, that takes an implementation of a remote applicative, splits the monad into applicatives without any merge stragegy, and uses the remote applicative. Every >>= will generate a call to the RemoteApplicative handler; as well as one terminating call. Using runBindeeMonad with a runWeakApplicative gives the weakest remote monad.