transformers-abort-0.6.0.1: Error and short-circuit monad transformers

Safe HaskellNone
LanguageHaskell98

Control.Monad.Trans.Finish

Description

Short-circuit monad transformer.

Synopsis

Documentation

newtype FinishT f μ α Source #

A monad transformer that extends monad μ with the ability to short-circuit computations with a value of type f.

  runFinishT $ do someStuff
                  when condition $ finish reason
                  otherwiseContinue

Constructors

FinishT 

Fields

Instances

MonadBase η μ => MonadBase η (FinishT f μ) Source # 

Methods

liftBase :: η α -> FinishT f μ α #

MonadBaseControl η μ => MonadBaseControl η (FinishT e μ) Source # 

Associated Types

type StM (FinishT e μ :: * -> *) a :: * #

Methods

liftBaseWith :: (RunInBase (FinishT e μ) η -> η a) -> FinishT e μ a #

restoreM :: StM (FinishT e μ) a -> FinishT e μ a #

MonadTrans (FinishT f) Source # 

Methods

lift :: Monad m => m a -> FinishT f m a #

MonadTransControl (FinishT f) Source # 

Associated Types

type StT (FinishT f :: (* -> *) -> * -> *) a :: * #

Methods

liftWith :: Monad m => (Run (FinishT f) -> m a) -> FinishT f m a #

restoreT :: Monad m => m (StT (FinishT f) a) -> FinishT f m a #

BindTrans (FinishT f) Source # 

Methods

liftB :: Bind b => b a -> FinishT f b a #

Monad μ => Monad (FinishT f μ) Source # 

Methods

(>>=) :: FinishT f μ a -> (a -> FinishT f μ b) -> FinishT f μ b #

(>>) :: FinishT f μ a -> FinishT f μ b -> FinishT f μ b #

return :: a -> FinishT f μ a #

fail :: String -> FinishT f μ a #

Functor μ => Functor (FinishT f μ) Source # 

Methods

fmap :: (a -> b) -> FinishT f μ a -> FinishT f μ b #

(<$) :: a -> FinishT f μ b -> FinishT f μ a #

MonadFix μ => MonadFix (FinishT f μ) Source # 

Methods

mfix :: (a -> FinishT f μ a) -> FinishT f μ a #

MonadFail μ => MonadFail (FinishT f μ) Source # 

Methods

fail :: String -> FinishT f μ a #

(Functor μ, Monad μ) => Applicative (FinishT f μ) Source # 

Methods

pure :: a -> FinishT f μ a #

(<*>) :: FinishT f μ (a -> b) -> FinishT f μ a -> FinishT f μ b #

(*>) :: FinishT f μ a -> FinishT f μ b -> FinishT f μ b #

(<*) :: FinishT f μ a -> FinishT f μ b -> FinishT f μ a #

(Eq f, Eq1 μ) => Eq1 (FinishT f μ) Source # 

Methods

liftEq :: (a -> b -> Bool) -> FinishT f μ a -> FinishT f μ b -> Bool #

(Ord f, Ord1 μ) => Ord1 (FinishT f μ) Source # 

Methods

liftCompare :: (a -> b -> Ordering) -> FinishT f μ a -> FinishT f μ b -> Ordering #

(Read f, Read1 μ) => Read1 (FinishT f μ) Source # 

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (FinishT f μ a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [FinishT f μ a] #

(Show f, Show1 μ) => Show1 (FinishT f μ) Source # 

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> FinishT f μ a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [FinishT f μ a] -> ShowS #

MonadZip μ => MonadZip (FinishT f μ) Source # 

Methods

mzip :: FinishT f μ a -> FinishT f μ b -> FinishT f μ (a, b) #

mzipWith :: (a -> b -> c) -> FinishT f μ a -> FinishT f μ b -> FinishT f μ c #

munzip :: FinishT f μ (a, b) -> (FinishT f μ a, FinishT f μ b) #

MonadIO μ => MonadIO (FinishT f μ) Source # 

Methods

liftIO :: IO a -> FinishT f μ a #

Pointed μ => Pointed (FinishT f μ) Source # 

Methods

point :: a -> FinishT f μ a #

(Functor μ, Monad μ) => Apply (FinishT f μ) Source # 

Methods

(<.>) :: FinishT f μ (a -> b) -> FinishT f μ a -> FinishT f μ b #

(.>) :: FinishT f μ a -> FinishT f μ b -> FinishT f μ b #

(<.) :: FinishT f μ a -> FinishT f μ b -> FinishT f μ a #

(Functor μ, Monad μ) => Bind (FinishT f μ) Source # 

Methods

(>>-) :: FinishT f μ a -> (a -> FinishT f μ b) -> FinishT f μ b #

join :: FinishT f μ (FinishT f μ a) -> FinishT f μ a #

(Eq f, Eq1 μ, Eq α) => Eq (FinishT f μ α) Source # 

Methods

(==) :: FinishT f μ α -> FinishT f μ α -> Bool #

(/=) :: FinishT f μ α -> FinishT f μ α -> Bool #

(Ord f, Ord1 μ, Ord α) => Ord (FinishT f μ α) Source # 

Methods

compare :: FinishT f μ α -> FinishT f μ α -> Ordering #

(<) :: FinishT f μ α -> FinishT f μ α -> Bool #

(<=) :: FinishT f μ α -> FinishT f μ α -> Bool #

(>) :: FinishT f μ α -> FinishT f μ α -> Bool #

(>=) :: FinishT f μ α -> FinishT f μ α -> Bool #

max :: FinishT f μ α -> FinishT f μ α -> FinishT f μ α #

min :: FinishT f μ α -> FinishT f μ α -> FinishT f μ α #

(Read f, Read1 μ, Read α) => Read (FinishT f μ α) Source # 

Methods

readsPrec :: Int -> ReadS (FinishT f μ α) #

readList :: ReadS [FinishT f μ α] #

readPrec :: ReadPrec (FinishT f μ α) #

readListPrec :: ReadPrec [FinishT f μ α] #

(Show f, Show1 μ, Show α) => Show (FinishT f μ α) Source # 

Methods

showsPrec :: Int -> FinishT f μ α -> ShowS #

show :: FinishT f μ α -> String #

showList :: [FinishT f μ α] -> ShowS #

type StT (FinishT f) α Source # 
type StT (FinishT f) α = Either f α
type StM (FinishT e μ) α Source # 
type StM (FinishT e μ) α = ComposeSt (FinishT e) μ α

runFinishT' :: Monad μ => FinishT α μ α -> μ α Source #

A version of runFinishT for the cases where you don't need to distinguish between short-circuits and regular computation results.

finish :: Monad μ => f -> FinishT f μ α Source #

Short-circuit the enclosing computation.

type Finish f α = FinishT f Identity α Source #

An alias for FinishT over Identity.

runFinish :: Finish f α -> Either f α Source #

runFinishT specialized for Finish.

runFinish' :: Finish α α -> α Source #

runFinishT' specialized to Finish.