Safe Haskell | None |
---|---|
Language | Haskell2010 |
Extensions |
|
This monad transformer extends a monad with the ability to fail.
Synopsis
- type Result = ResultT Identity
- pattern Result :: Except String a -> Result a
- runResult :: Result a -> Except String a
- newtype ResultT m a = ResultT (ExceptT String m a)
- runResultT :: ResultT m a -> ExceptT String m a
- mapResultT :: (ExceptT String m a -> ExceptT String n b) -> ResultT m a -> ResultT n b
- throwE :: Monad m => String -> ResultT m a
- catchE :: Monad m => ResultT m a -> (String -> ResultT m a) -> ResultT m a
- liftCallCC :: CallCC m (Either String a) (Either String b) -> CallCC (ResultT m) a b
- liftListen :: Monad m => Listen w m (Either String a) -> Listen w (ResultT m) a
- liftPass :: Monad m => Pass w m (Either String a) -> Pass w (ResultT m) a
The Result monad
The ResultT monad transformer
A monad transformer that is similar to ExceptT
except a MonadFail
instance.
MonadFail
=ResultT
.throwE
Instances
mapResultT :: (ExceptT String m a -> ExceptT String n b) -> ResultT m a -> ResultT n b Source #
Map the unwrapped computation using the given function.
Exception operations
catchE :: Monad m => ResultT m a -> (String -> ResultT m a) -> ResultT m a Source #
Handle an exception.
Lifting other operations
liftCallCC :: CallCC m (Either String a) (Either String b) -> CallCC (ResultT m) a b Source #
Lift a callCC
operation to the new monad.