-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Computational Effects -- -- An alternative to Monad Transformers. @package effects @version 0 module Control.Effects data Handler e m a r Handler :: (a -> m e) -> (e -> m r) -> Handler e m a r ret :: Handler e m a r -> a -> m e fin :: Handler e m a r -> e -> m r with :: Monad m => Handler e m a r -> (Proxy (ContT e m) -> ContT e m a) -> m r operation :: (m ~ (ContT r m'), AutoLift m n) => Proxy m -> ((a -> m' r) -> m' r) -> n a run :: Cont a a -> a runIO :: ContT () IO () -> IO () io :: AutoLift (ContT () IO) n => IO a -> n a ioHandler :: Handler a IO a a -- | Continuation monad. Cont r a is a CPS computation that -- produces an intermediate result of type a within a CPS -- computation whose final result type is r. -- -- The return function simply creates a continuation which -- passes the value on. -- -- The >>= operator adds the bound function into the -- continuation chain. type Cont r = ContT r Identity -- | The continuation monad transformer. Can be used to add continuation -- handling to other monads. data ContT r m :: (* -> *) a :: * -> (* -> *) -> * -> * data Proxy m :: (* -> *) class AutoLift m1 m2 instance AutoLift' m1 m2 m1 m2 => AutoLift m1 m2 instance AutoLift' m1 m2 n1 n2 => AutoLift' m1 m2 (ContT r1 n1) (ContT r2 n2) instance (AutoLift' m1 m2 Identity n, Monad m2) => AutoLift' m1 (ContT r m2) Identity (ContT s n) instance (AutoLift' m1 m2 IO n, Monad m2) => AutoLift' m1 (ContT r m2) IO (ContT s n) instance m1 ~ m2 => AutoLift' m1 m2 Identity Identity instance m1 ~ m2 => AutoLift' m1 m2 IO IO module Control.Effects.Cont shift :: (c ~ (ContT r m), AutoLift c n, Monad m) => Proxy c -> ((m a -> m r) -> m r) -> n a reset :: Monad m => Handler a m a a module Control.Effects.Either throwEither :: (c ~ (ContT (m (Either e r)) m), AutoLift c n, Monad m) => Proxy c -> e -> n Void catchEither :: Monad m => (e -> m a) -> Handler (m (Either e a)) m a a module Control.Effects.Error throwError :: (c ~ (ContT ((e -> m r) -> m r) m), AutoLift c n, Monad m) => Proxy c -> e -> n Void catchError :: Monad m => (e -> m a) -> Handler ((e -> m a) -> m a) m a a module Control.Effects.Set choose :: (c ~ (ContT (Set r) m), AutoLift c n, Monad m, Ord r) => Proxy c -> [a] -> n a set :: (Monad m, Ord a) => Handler (Set a) m a (Set a) module Control.Effects.State get :: (c ~ (ContT (s -> m r) m), AutoLift c n, Monad m) => Proxy c -> n s put :: (c ~ (ContT (s -> m r) m), AutoLift c n, Monad m) => Proxy c -> s -> n () ref :: Monad m => s -> Handler (s -> m a) m a a module Control.Effects.Writer tell :: (c ~ (ContT (w, r) m), AutoLift c n, Monad m, Monoid w) => Proxy c -> w -> n () writer :: (Monad m, Monoid w) => Handler (w, a) m a (w, a)