-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Control flow data type and monad transformer. -- -- Control flow abstraction for short-circuiting on success and failure -- as well as continuing with a value. @package transformers-continue @version 0.0.1 -- | Continue type. module Data.Continue -- | The Continue type represents values with three possibilities: a -- value of type Continue a b is one of -- Stop , Failure x or -- Continue a. data Continue x a Stop :: Continue x a Failure :: x -> Continue x a Continue :: a -> Continue x a instance Data.Traversable.Traversable (Data.Continue.Continue x) instance Data.Foldable.Foldable (Data.Continue.Continue x) instance GHC.Base.Functor (Data.Continue.Continue x) instance (GHC.Show.Show a, GHC.Show.Show x) => GHC.Show.Show (Data.Continue.Continue x a) instance (GHC.Classes.Eq a, GHC.Classes.Eq x) => GHC.Classes.Eq (Data.Continue.Continue x a) instance GHC.Base.Applicative (Data.Continue.Continue x) instance Data.Bifunctor.Bifunctor Data.Continue.Continue instance GHC.Base.Monad (Data.Continue.Continue x) -- | This monad transformer extends a monad with the ability to handle -- multiple terminating cases. -- -- A sequence of actions terminates normally, producing a value, only if -- none of the actions in the sequence are Stop or Failure. -- If one action is Stop or Failure, the rest of the -- sequence is skipped and the composite action exits with that result. module Control.Monad.Trans.Continue -- | A monad transfomer that extends the Continue monad. -- -- Computations are stopes, failures or normal values. -- -- The return function returns a normal value, while -- >>= exits on the first stop or failure. newtype ContinueT x m a ContinueT :: m (Continue x a) -> ContinueT x m a [runContinueT] :: ContinueT x m a -> m (Continue x a) -- | Singal a stop. -- -- stop :: Applicative m => ContinueT x m a -- | Singal a failure value x. -- -- failure :: Applicative m => x -> ContinueT x m a -- | Singal a continue value x. -- -- continue :: Applicative m => a -> ContinueT x m a -- | Lift an Continue into an ContinueT hoistContinue :: Monad m => Continue x a -> ContinueT x m a -- | Map the unwrapped computation using the given function. -- --
--   runContinueT (mapContinueT f m) = f (runContinueT m)
--   
mapContinueT :: (m (Continue x a) -> n (Continue y b)) -> ContinueT x m a -> ContinueT y n b -- | Map over both failure and continue. bimapContinueT :: Functor m => (x -> y) -> (a -> b) -> ContinueT x m a -> ContinueT y m b -- | Map over failure. firstContinueT :: Functor m => (x -> y) -> ContinueT x m a -> ContinueT y m a -- | Map over continue. secondContinueT :: Functor m => (a -> b) -> ContinueT x m a -> ContinueT x m b -- | Map over failure. mapFailure :: Functor m => (x -> y) -> ContinueT x m a -> ContinueT y m a -- | Lift an Maybe into an ContinueT -- -- stopFromNothing :: Applicative m => Maybe a -> ContinueT x m a -- | Lift an Either into an ContinueT -- -- hoistEither :: Applicative m => Either x a -> ContinueT x m a -- | Utility function for EitherT pattern synonym over ExceptT liftEitherT :: Monad m => ExceptT x m a -> ContinueT x m a -- | Convert an ExceptT into an ContinueT -- -- liftExceptT :: Monad m => ExceptT x m a -> ContinueT x m a -- | Utility function for EitherT pattern synonym over ExceptT runToEitherT :: Monad m => ContinueT x m () -> ExceptT x m () -- | Convert an ContinueT into an ExceptT -- -- runToExceptT :: Monad m => ContinueT x m () -> ExceptT x m () instance Data.Traversable.Traversable m => Data.Traversable.Traversable (Control.Monad.Trans.Continue.ContinueT x m) instance Data.Foldable.Foldable m => Data.Foldable.Foldable (Control.Monad.Trans.Continue.ContinueT x m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Trans.Continue.ContinueT x m) instance (GHC.Base.Applicative m, GHC.Base.Monad m) => GHC.Base.Applicative (Control.Monad.Trans.Continue.ContinueT x m) instance GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.Trans.Continue.ContinueT x m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Monad.Trans.Continue.ContinueT x m) instance Control.Monad.Trans.Class.MonadTrans (Control.Monad.Trans.Continue.ContinueT x)