Copyright | (c) Andrey Mokhov 2018-2024 |
---|---|
License | MIT (see the file LICENSE) |
Maintainer | andrey.mokhov@gmail.com |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This is a library for selective applicative functors, or just selective functors for short, an abstraction between applicative functors and monads, introduced in this paper: https://dl.acm.org/doi/10.1145/3341694.
This module defines a newtype around ExceptT
from transformers
with less
restrictive Applicative
, Selective
, and Alternative
implementations.
It supplies an instance
, which
makes Selective
f => Selective
(ExceptT
e f)ExceptT
a bona-fide Selective
transformer.
The API follows the API from the transformers
package, so it can be used as
a drop-in replacement. The documentation can be found in the
transformers
package.
Synopsis
- newtype ExceptT e f a = ExceptT {}
- wrap :: ExceptT e m a -> ExceptT e m a
- type Except e = ExceptT e Identity
- except :: Monad m => Either e a -> ExceptT e m a
- runExcept :: Except e a -> Either e a
- mapExcept :: (Either e a -> Either e' b) -> Except e a -> Except e' b
- withExcept :: (e -> e') -> Except e a -> Except e' a
- runExceptT :: ExceptT e m a -> m (Either e a)
- mapExceptT :: (m (Either e a) -> n (Either e' b)) -> ExceptT e m a -> ExceptT e' n b
- withExceptT :: Functor m => (e -> e') -> ExceptT e m a -> ExceptT e' m a
- throwE :: Monad m => e -> ExceptT e m a
- catchE :: Monad m => ExceptT e m a -> (e -> ExceptT e' m a) -> ExceptT e' m a
- liftCallCC :: CallCC m (Either e a) (Either e b) -> CallCC (ExceptT e m) a b
- liftListen :: Monad m => Listen w m (Either e a) -> Listen w (ExceptT e m) a
- liftPass :: Monad m => Pass w m (Either e a) -> Pass w (ExceptT e m) a
Documentation
newtype ExceptT e f a Source #
A newtype wrapper around ExceptT
from transformers
that provides less
restrictive Applicative
, Selective
and Alternative
instances.
Instances
withExcept :: (e -> e') -> Except e a -> Except e' a Source #
runExceptT :: ExceptT e m a -> m (Either e a) Source #