garden
Maintainergatlin@niltag.net
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

LCPS

Description

Alternate implementation of CPS with linear types to see what, if any, benefits there may be from doing so.

Synopsis

Delimited Continuation Monad Transformer

data CPS (result :: k) (m :: k -> Type) (answer :: Type) where Source #

Continuation Passing Style: - A monad whose side effect is flow-control. - - When m is a Monad then CPS is a monad transformer over m. - However it should be noted that 'CPS r m' is a Monad regardless of m. - - Delimited continuation operators shift and reset have been defined in - this module as well.

Constructors

CPS :: ((answer -> m result) -> m result) -> CPS result m answer 

Instances

Instances details
MonadIO m => MonadIO (CPS () m) Source # 
Instance details

Defined in LCPS

Methods

liftIO :: IO a -> CPS () m a Source #

HasFork m => Alternative (CPS () m) Source # 
Instance details

Defined in LCPS

Methods

empty :: CPS () m a Source #

(<|>) :: CPS () m a -> CPS () m a -> CPS () m a Source #

some :: CPS () m a -> CPS () m [a] Source #

many :: CPS () m a -> CPS () m [a] Source #

Applicative (CPS r m) Source # 
Instance details

Defined in LCPS

Methods

pure :: a -> CPS r m a Source #

(<*>) :: CPS r m (a -> b) -> CPS r m a -> CPS r m b Source #

liftA2 :: (a -> b -> c) -> CPS r m a -> CPS r m b -> CPS r m c Source #

(*>) :: CPS r m a -> CPS r m b -> CPS r m b Source #

(<*) :: CPS r m a -> CPS r m b -> CPS r m a Source #

Functor (CPS r m) Source # 
Instance details

Defined in LCPS

Methods

fmap :: (a -> b) -> CPS r m a -> CPS r m b Source #

(<$) :: a -> CPS r m b -> CPS r m a Source #

Monad (CPS r m) Source # 
Instance details

Defined in LCPS

Methods

(>>=) :: CPS r m a -> (a -> CPS r m b) -> CPS r m b Source #

(>>) :: CPS r m a -> CPS r m b -> CPS r m b Source #

return :: a -> CPS r m a Source #

HasFork m => MonadPlus (CPS () m) Source # 
Instance details

Defined in LCPS

Methods

mzero :: CPS () m a Source #

mplus :: CPS () m a -> CPS () m a -> CPS () m a Source #

(#) :: CPS result m answer -> (answer -> m result) -> m result Source #

shift :: Monad m => ((a -> m r) -> CPS r m r) -> CPS r m a Source #

reset :: Monad m => CPS r m r -> m r Source #

Utilities

lift :: Monad m => m a -> CPS r m a Source #