| Copyright | (c) Andrey Mokhov 2018-2024 |
|---|---|
| License | MIT (see the file LICENSE) |
| Maintainer | andrey.mokhov@gmail.com |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
Control.Selective.Trans.Except
Description
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 :: Type -> Type) a = ExceptT {
- unwrap :: ExceptT e f a
- wrap :: forall e (m :: Type -> Type) a. ExceptT e m a -> ExceptT e m a
- type Except e = ExceptT e Identity
- except :: forall (m :: Type -> Type) e a. 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 :: forall (m :: Type -> Type) e e' a. Functor m => (e -> e') -> ExceptT e m a -> ExceptT e' m a
- throwE :: forall (m :: Type -> Type) e a. Monad m => e -> ExceptT e m a
- catchE :: forall (m :: Type -> Type) e a e'. 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 :: Type -> Type) a Source #
A newtype wrapper around ExceptT from transformers that provides less
restrictive Applicative, Selective and Alternative instances.
Instances
| (Selective f, MonadIO f) => MonadIO (ExceptT e f) Source # | |
Defined in Control.Selective.Trans.Except | |
| (Selective f, MonadZip f) => MonadZip (ExceptT e f) Source # | |
| (Eq1 f, Eq e) => Eq1 (ExceptT e f) Source # | |
Defined in Control.Selective.Trans.Except | |
| (Ord1 f, Ord e) => Ord1 (ExceptT e f) Source # | |
Defined in Control.Selective.Trans.Except Methods liftCompare :: (a -> b -> Ordering) -> ExceptT e f a -> ExceptT e f b -> Ordering | |
| (Read1 f, Read e) => Read1 (ExceptT e f) Source # | |
Defined in Control.Selective.Trans.Except Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (ExceptT e f a) liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [ExceptT e f a] liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (ExceptT e f a) liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [ExceptT e f a] | |
| (Show1 f, Show e) => Show1 (ExceptT e f) Source # | |
Defined in Control.Selective.Trans.Except Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> ExceptT e f a -> ShowS liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [ExceptT e f a] -> ShowS | |
| Contravariant f => Contravariant (ExceptT e f) Source # | |
| (Selective f, Monoid e) => Alternative (ExceptT e f) Source # | |
| Selective f => Applicative (ExceptT e f) Source # | |
Defined in Control.Selective.Trans.Except | |
| Functor f => Functor (ExceptT e f) Source # | |
| (Selective f, Monad f) => Monad (ExceptT e f) Source # | |
| (Selective f, Monoid e, Monad f) => MonadPlus (ExceptT e f) Source # | |
| (Selective f, MonadFail f) => MonadFail (ExceptT e f) Source # | |
Defined in Control.Selective.Trans.Except | |
| (Selective f, MonadFix f) => MonadFix (ExceptT e f) Source # | |
Defined in Control.Selective.Trans.Except | |
| Foldable f => Foldable (ExceptT e f) Source # | |
Defined in Control.Selective.Trans.Except Methods fold :: Monoid m => ExceptT e f m -> m foldMap :: Monoid m => (a -> m) -> ExceptT e f a -> m foldMap' :: Monoid m => (a -> m) -> ExceptT e f a -> m foldr :: (a -> b -> b) -> b -> ExceptT e f a -> b foldr' :: (a -> b -> b) -> b -> ExceptT e f a -> b foldl :: (b -> a -> b) -> b -> ExceptT e f a -> b foldl' :: (b -> a -> b) -> b -> ExceptT e f a -> b foldr1 :: (a -> a -> a) -> ExceptT e f a -> a foldl1 :: (a -> a -> a) -> ExceptT e f a -> a toList :: ExceptT e f a -> [a] length :: ExceptT e f a -> Int elem :: Eq a => a -> ExceptT e f a -> Bool maximum :: Ord a => ExceptT e f a -> a minimum :: Ord a => ExceptT e f a -> a | |
| Traversable f => Traversable (ExceptT e f) Source # | |
Defined in Control.Selective.Trans.Except | |
| Selective f => Selective (ExceptT e f) Source # | |
| (Read1 f, Read e, Read a) => Read (ExceptT e f a) Source # | |
Defined in Control.Selective.Trans.Except | |
| (Show1 f, Show e, Show a) => Show (ExceptT e f a) Source # | |
| (Eq1 f, Eq e, Eq a) => Eq (ExceptT e f a) Source # | |
| (Ord1 f, Ord e, Ord a) => Ord (ExceptT e f a) Source # | |
Defined in Control.Selective.Trans.Except | |
wrap :: forall e (m :: Type -> Type) a. ExceptT e m a -> ExceptT e m a Source #
Inject an ExceptT value into the newtype wrapper.
withExcept :: (e -> e') -> Except e a -> Except e' a Source #
runExceptT :: ExceptT e m a -> m (Either e a) Source #
mapExceptT :: (m (Either e a) -> n (Either e' b)) -> ExceptT e m a -> ExceptT e' n b Source #
withExceptT :: forall (m :: Type -> Type) e e' a. Functor m => (e -> e') -> ExceptT e m a -> ExceptT e' m a Source #
catchE :: forall (m :: Type -> Type) e a e'. Monad m => ExceptT e m a -> (e -> ExceptT e' m a) -> ExceptT e' m a Source #
liftCallCC :: CallCC m (Either e a) (Either e b) -> CallCC (ExceptT e m) a b Source #
liftListen :: Monad m => Listen w m (Either e a) -> Listen w (ExceptT e m) a Source #