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

Safe HaskellNone
LanguageHaskell2010

Parameterized.Control.Monad.Trans.State.Strict

Synopsis

Documentation

newtype ManyState m s a Source #

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

Constructors

ManyState 

Fields

Instances

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

Methods

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

Monad m => PPointed * (ManyState m) (Many ([] Type)) Source # 

Methods

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

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

Methods

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

(Monad m, Select a c, Select b c, Amend' a c, Amend' b c, (~) [Type] c (AppendUnique Type a b)) => PApplicative * (ManyState m) (Many a) (Many b) (Many c) Source # 

Methods

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

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

Methods

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

Monad m => Monad (ManyState m s) Source # 

Methods

(>>=) :: ManyState m s a -> (a -> ManyState m s b) -> ManyState m s b #

(>>) :: ManyState m s a -> ManyState m s b -> ManyState m s b #

return :: a -> ManyState m s a #

fail :: String -> ManyState m s a #

Functor m => Functor (ManyState m s) Source # 

Methods

fmap :: (a -> b) -> ManyState m s a -> ManyState m s b #

(<$) :: a -> ManyState m s b -> ManyState m s a #

MonadFix m => MonadFix (ManyState m s) Source # 

Methods

mfix :: (a -> ManyState m s a) -> ManyState m s a #

MonadFail m => MonadFail (ManyState m s) Source # 

Methods

fail :: String -> ManyState m s a #

Monad m => Applicative (ManyState m s) Source # 

Methods

pure :: a -> ManyState m s a #

(<*>) :: ManyState m s (a -> b) -> ManyState m s a -> ManyState m s b #

(*>) :: ManyState m s a -> ManyState m s b -> ManyState m s b #

(<*) :: ManyState m s a -> ManyState m s b -> ManyState m s a #

MonadIO m => MonadIO (ManyState m s) Source # 

Methods

liftIO :: IO a -> ManyState m s a #

MonadPlus m => Alternative (ManyState m s) Source # 

Methods

empty :: ManyState m s a #

(<|>) :: ManyState m s a -> ManyState m s a -> ManyState m s a #

some :: ManyState m s a -> ManyState m s [a] #

many :: ManyState m s a -> ManyState m s [a] #

MonadPlus m => MonadPlus (ManyState m s) Source # 

Methods

mzero :: ManyState m s a #

mplus :: ManyState m s a -> ManyState m s a -> ManyState m s a #

Generic (ManyState m s a) Source # 

Associated Types

type Rep (ManyState m s a) :: * -> * #

Methods

from :: ManyState m s a -> Rep (ManyState m s a) x #

to :: Rep (ManyState m s a) x -> ManyState m s a #

type PUnary * (ManyState m) s Source # 
type PUnary * (ManyState m) s = ManyState m s
type Rep (ManyState m s a) Source # 
type Rep (ManyState m s a) = D1 (MetaData "ManyState" "Parameterized.Control.Monad.Trans.State.Strict" "parameterized-0.5.0.0-EMeutE5jJ2JEdVqeGBcPpd" True) (C1 (MetaCons "ManyState" PrefixI True) (S1 (MetaSel (Just Symbol "runManyState") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (StateT s m a))))

newtype ChangingState m st a Source #

Given a ChangingState that changes state from s to t, and another ChangingState that changes state from t to u make a State that changes from s to u with the compile time constraint that all the types in (AppendUnique a b) are distinct. NB. The state is in the snd position to be consistent with StateT.

Constructors

ChangingState 

Fields

Instances

Applicative m => PPointed * (ChangingState m) (s, s) Source # 

Methods

ppure :: a -> PUnary (ChangingState m) (s, s) id a Source #

Monad m => PApplicative * (ChangingState m) (s, t) (t, u) (s, u) Source # 

Methods

papply :: PUnary (ChangingState m) (s, t) (t, u) (a -> b) -> PUnary (ChangingState m) (s, t) (s, u) a -> PUnary (ChangingState m) (s, t) v b Source #

Monad m => PMonad * (ChangingState m) (s, t) (t, u) (s, u) Source # 

Methods

pbind :: PUnary (ChangingState m) (s, t) (t, u) a -> (a -> PUnary (ChangingState m) (s, t) (s, u) b) -> PUnary (ChangingState m) (s, t) v b Source #

Functor m => Functor (ChangingState m st) Source # 

Methods

fmap :: (a -> b) -> ChangingState m st a -> ChangingState m st b #

(<$) :: a -> ChangingState m st b -> ChangingState m st a #

Generic (ChangingState m st a) Source # 

Associated Types

type Rep (ChangingState m st a) :: * -> * #

Methods

from :: ChangingState m st a -> Rep (ChangingState m st a) x #

to :: Rep (ChangingState m st a) x -> ChangingState m st a #

type PUnary * (ChangingState m) st Source # 
type PUnary * (ChangingState m) st = ChangingState m st
type Rep (ChangingState m st a) Source # 
type Rep (ChangingState m st a) = D1 (MetaData "ChangingState" "Parameterized.Control.Monad.Trans.State.Strict" "parameterized-0.5.0.0-EMeutE5jJ2JEdVqeGBcPpd" True) (C1 (MetaCons "ChangingState" PrefixI True) (S1 (MetaSel (Just Symbol "runChangingState") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (At0 st -> m (a, At1 st)))))

changingState :: (s -> m (a, t)) -> ChangingState m (s, t) a Source #

Prefer this to using ChangingState to construct as it results in better type inference as it avoids ambiguous type variable st