parameterized-0.5.0.0: Parameterized/indexed monoids and monads using only a single parameter type variable.

Safe HaskellNone
LanguageHaskell2010

Parameterized.Control.Monad.Trans.Reader

Synopsis

Documentation

newtype OverlappingWhichReader m r a Source #

Given a Reader that accepts Which a, and another Reader that accepts Which b make a reader that accepts Which (AppendUnique a b) and runs both readers if possible, where the types in Which a and Which b may overlap, but with the compile time constraint that all the types in (AppendUnique a b) are distinct.

Instances

Alternative m => PEmpty * (OverlappingWhichReader m) (Which ([] Type)) Source # 
Applicative m => PPointed * (OverlappingWhichReader m) (Which ([] Type)) Source # 

Methods

ppure :: a -> PUnary (OverlappingWhichReader m) (Which [Type]) id a Source #

(Alternative m, Reinterpret b c, Reinterpret a c, (~) [Type] c (AppendUnique Type a b)) => PAlternative * (OverlappingWhichReader m) (Which a) (Which b) (Which c) Source # 
Monad m => Monad (OverlappingWhichReader m r) Source # 
Functor m => Functor (OverlappingWhichReader m r) Source # 

Methods

fmap :: (a -> b) -> OverlappingWhichReader m r a -> OverlappingWhichReader m r b #

(<$) :: a -> OverlappingWhichReader m r b -> OverlappingWhichReader m r a #

MonadFix m => MonadFix (OverlappingWhichReader m r) Source # 

Methods

mfix :: (a -> OverlappingWhichReader m r a) -> OverlappingWhichReader m r a #

MonadFail m => MonadFail (OverlappingWhichReader m r) Source # 

Methods

fail :: String -> OverlappingWhichReader m r a #

Applicative m => Applicative (OverlappingWhichReader m r) Source # 
MonadZip m => MonadZip (OverlappingWhichReader m r) Source # 
MonadIO m => MonadIO (OverlappingWhichReader m r) Source # 

Methods

liftIO :: IO a -> OverlappingWhichReader m r a #

Alternative m => Alternative (OverlappingWhichReader m r) Source # 
MonadPlus m => MonadPlus (OverlappingWhichReader m r) Source # 
Generic (OverlappingWhichReader m r a) Source # 

Associated Types

type Rep (OverlappingWhichReader m r a) :: * -> * #

type PUnary * (OverlappingWhichReader m) r Source # 
type Rep (OverlappingWhichReader m r a) Source # 
type Rep (OverlappingWhichReader m r a) = D1 (MetaData "OverlappingWhichReader" "Parameterized.Control.Monad.Trans.Reader" "parameterized-0.5.0.0-EMeutE5jJ2JEdVqeGBcPpd" True) (C1 (MetaCons "OverlappingWhichReader" PrefixI True) (S1 (MetaSel (Just Symbol "runOverlappingWhichReader") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (ReaderT * r m a))))

newtype DistinctWhichReader m r a Source #

Given a Reader that accepts Which a, and another Reader that accepts Which b make a reader that accepts Which (Append a b) and only run one of the readers for the correct Which type, with a compile-time contraint that the types in Which a are distinct from the type in Which b The advantage of DistinctWhichReader over OverlappingWhichReader is that pappend doesn't require the inner monad m to be an Alternative. NB. PEmpty still requires Alternative but you don't need to be an instance of PEmpty (analogous to Semigroup)

Constructors

DistinctWhichReader 

Instances

Alternative m => PEmpty * (DistinctWhichReader m) (Which ([] Type)) Source # 
Applicative m => PPointed * (DistinctWhichReader m) (Which ([] Type)) Source # 

Methods

ppure :: a -> PUnary (DistinctWhichReader m) (Which [Type]) id a Source #

(Reinterpret b c, (~) [Type] (Complement Type c b) a, (~) [Type] (Complement Type c a) b, (~) [Type] c (Append Type a b)) => PAlternative * (DistinctWhichReader m) (Which a) (Which b) (Which c) Source # 
Monad m => Monad (DistinctWhichReader m r) Source # 
Functor m => Functor (DistinctWhichReader m r) Source # 

Methods

fmap :: (a -> b) -> DistinctWhichReader m r a -> DistinctWhichReader m r b #

(<$) :: a -> DistinctWhichReader m r b -> DistinctWhichReader m r a #

MonadFix m => MonadFix (DistinctWhichReader m r) Source # 

Methods

mfix :: (a -> DistinctWhichReader m r a) -> DistinctWhichReader m r a #

MonadFail m => MonadFail (DistinctWhichReader m r) Source # 

Methods

fail :: String -> DistinctWhichReader m r a #

Applicative m => Applicative (DistinctWhichReader m r) Source # 
MonadZip m => MonadZip (DistinctWhichReader m r) Source # 
MonadIO m => MonadIO (DistinctWhichReader m r) Source # 

Methods

liftIO :: IO a -> DistinctWhichReader m r a #

Alternative m => Alternative (DistinctWhichReader m r) Source # 
MonadPlus m => MonadPlus (DistinctWhichReader m r) Source # 
Generic (DistinctWhichReader m r a) Source # 

Associated Types

type Rep (DistinctWhichReader m r a) :: * -> * #

type PUnary * (DistinctWhichReader m) r Source # 
type Rep (DistinctWhichReader m r a) Source # 
type Rep (DistinctWhichReader m r a) = D1 (MetaData "DistinctWhichReader" "Parameterized.Control.Monad.Trans.Reader" "parameterized-0.5.0.0-EMeutE5jJ2JEdVqeGBcPpd" True) (C1 (MetaCons "DistinctWhichReader" PrefixI True) (S1 (MetaSel (Just Symbol "runDistinctWhichReader") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (ReaderT * r m a))))

newtype ManyReader m r a Source #

Given a Reader that accepts Many a, and another Reader that accepts Many b make a reader that accepts Many (AppendUnique a b) with the compile time constraint that all the types in (AppendUnique a b) are distinct.

Constructors

ManyReader 

Fields

Instances

Alternative m => PEmpty * (ManyReader m) (Many ([] Type)) Source # 

Methods

pempty :: PUnary (ManyReader m) (Many [Type]) id a Source #

Applicative m => PPointed * (ManyReader m) (Many ([] Type)) Source # 

Methods

ppure :: a -> PUnary (ManyReader m) (Many [Type]) id a Source #

(Alternative m, Select a c, Select b c, (~) [Type] c (AppendUnique Type a b)) => PAlternative * (ManyReader m) (Many a) (Many b) (Many c) Source # 

Methods

pappend :: PUnary (ManyReader m) (Many a) (Many b) a -> PUnary (ManyReader m) (Many a) (Many c) a -> PUnary (ManyReader m) (Many a) v a Source #

(Functor (ManyReader m (Many c)), Applicative m, Select a c, Select b c, (~) [Type] c (AppendUnique Type a b)) => PApplicative * (ManyReader m) (Many a) (Many b) (Many c) Source # 

Methods

papply :: PUnary (ManyReader m) (Many a) (Many b) (a -> b) -> PUnary (ManyReader m) (Many a) (Many c) a -> PUnary (ManyReader m) (Many a) v b Source #

(Functor (ManyReader m (Many c)), Monad m, Select a c, Select b c, (~) [Type] c (AppendUnique Type a b)) => PMonad * (ManyReader m) (Many a) (Many b) (Many c) Source # 

Methods

pbind :: PUnary (ManyReader m) (Many a) (Many b) a -> (a -> PUnary (ManyReader m) (Many a) (Many c) b) -> PUnary (ManyReader m) (Many a) v b Source #

Monad m => Monad (ManyReader m r) Source # 

Methods

(>>=) :: ManyReader m r a -> (a -> ManyReader m r b) -> ManyReader m r b #

(>>) :: ManyReader m r a -> ManyReader m r b -> ManyReader m r b #

return :: a -> ManyReader m r a #

fail :: String -> ManyReader m r a #

Functor m => Functor (ManyReader m r) Source # 

Methods

fmap :: (a -> b) -> ManyReader m r a -> ManyReader m r b #

(<$) :: a -> ManyReader m r b -> ManyReader m r a #

MonadFix m => MonadFix (ManyReader m r) Source # 

Methods

mfix :: (a -> ManyReader m r a) -> ManyReader m r a #

MonadFail m => MonadFail (ManyReader m r) Source # 

Methods

fail :: String -> ManyReader m r a #

Applicative m => Applicative (ManyReader m r) Source # 

Methods

pure :: a -> ManyReader m r a #

(<*>) :: ManyReader m r (a -> b) -> ManyReader m r a -> ManyReader m r b #

(*>) :: ManyReader m r a -> ManyReader m r b -> ManyReader m r b #

(<*) :: ManyReader m r a -> ManyReader m r b -> ManyReader m r a #

MonadZip m => MonadZip (ManyReader m r) Source # 

Methods

mzip :: ManyReader m r a -> ManyReader m r b -> ManyReader m r (a, b) #

mzipWith :: (a -> b -> c) -> ManyReader m r a -> ManyReader m r b -> ManyReader m r c #

munzip :: ManyReader m r (a, b) -> (ManyReader m r a, ManyReader m r b) #

MonadIO m => MonadIO (ManyReader m r) Source # 

Methods

liftIO :: IO a -> ManyReader m r a #

Alternative m => Alternative (ManyReader m r) Source # 

Methods

empty :: ManyReader m r a #

(<|>) :: ManyReader m r a -> ManyReader m r a -> ManyReader m r a #

some :: ManyReader m r a -> ManyReader m r [a] #

many :: ManyReader m r a -> ManyReader m r [a] #

MonadPlus m => MonadPlus (ManyReader m r) Source # 

Methods

mzero :: ManyReader m r a #

mplus :: ManyReader m r a -> ManyReader m r a -> ManyReader m r a #

Generic (ManyReader m r a) Source # 

Associated Types

type Rep (ManyReader m r a) :: * -> * #

Methods

from :: ManyReader m r a -> Rep (ManyReader m r a) x #

to :: Rep (ManyReader m r a) x -> ManyReader m r a #

type PUnary * (ManyReader m) r Source # 
type PUnary * (ManyReader m) r = ManyReader m r
type Rep (ManyReader m r a) Source # 
type Rep (ManyReader m r a) = D1 (MetaData "ManyReader" "Parameterized.Control.Monad.Trans.Reader" "parameterized-0.5.0.0-EMeutE5jJ2JEdVqeGBcPpd" True) (C1 (MetaCons "ManyReader" PrefixI True) (S1 (MetaSel (Just Symbol "runManyReader") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (ReaderT * r m a))))