| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Control.Monad.Trans.MultiGST.Lazy
Description
Alternative multi-valued version of mtl's RWS / RWST. In contrast to
this version only takes a single list of types as
parameter, but with additional encoding of the allowed access for each
element. This supports the MultiRWS(T) notion more succinctly, i.e.
to pass a "state" element to a function that only requiresexpects readget
access. This is not possible with MonadMultiGetMultiRWS.
Synopsis
- newtype MultiGSTT (ts :: [CanReadWrite Type]) (m :: Type -> Type) a = MultiGSTT {
- runMultiGSTTRaw :: StateT (HListM ts) m a
- type MultiGSTTNull = MultiGSTT ('[] :: [CanReadWrite Type])
- type MultiGST (r :: [CanReadWrite Type]) = MultiGSTT r Identity
- type ContainsReader = HListMContains 'GettableFlag
- type ContainsState = HListMContains 'SettableFlag
- type ContainsWriter = HListMContains 'TellableFlag
- class Monad m => MonadMultiReader a (m :: Type -> Type) where
- mAsk :: m a
- class (Monad m, Monoid a) => MonadMultiWriter a (m :: Type -> Type) where
- mTell :: a -> m ()
- class Monad m => MonadMultiGet a (m :: Type -> Type) where
- mGet :: m a
- class MonadMultiGet a m => MonadMultiState a (m :: Type -> Type) where
- mSet :: a -> m ()
- data CanReadWrite a
- runMultiGSTTNil :: Monad m => MultiGSTT ('[] :: [CanReadWrite Type]) m a -> m a
- runMultiGSTTNil_ :: Monad m => MultiGSTT ('[] :: [CanReadWrite Type]) m a -> m ()
- withReader :: forall (m :: Type -> Type) t (tr :: [CanReadWrite Type]) a. Monad m => t -> MultiGSTT ('Gettable t ': tr) m a -> MultiGSTT tr m a
- withReader_ :: forall (m :: Type -> Type) t (tr :: [CanReadWrite Type]) a. Monad m => t -> MultiGSTT ('Gettable t ': tr) m a -> MultiGSTT tr m ()
- withReaders :: forall (m :: Type -> Type) (rs :: [Type]) (ts :: [CanReadWrite Type]) a. Monad m => HList rs -> MultiGSTT (AppendM (HListMReaders rs) ts) m a -> MultiGSTT ts m a
- withWriter :: forall t (m :: Type -> Type) (tr :: [CanReadWrite Type]) a. (Monoid t, Monad m) => MultiGSTT ('Tellable t ': tr) m a -> MultiGSTT tr m (a, t)
- withWriterAW :: forall t (m :: Type -> Type) (tr :: [CanReadWrite Type]) a. (Monoid t, Monad m) => MultiGSTT ('Tellable t ': tr) m a -> MultiGSTT tr m (a, t)
- withWriterWA :: forall t (m :: Type -> Type) (tr :: [CanReadWrite Type]) a. (Monoid t, Monad m) => MultiGSTT ('Tellable t ': tr) m a -> MultiGSTT tr m (t, a)
- withWriterW :: forall t (m :: Type -> Type) (tr :: [CanReadWrite Type]) a. (Monoid t, Monad m) => MultiGSTT ('Tellable t ': tr) m a -> MultiGSTT tr m t
- withState :: forall (m :: Type -> Type) t (tr :: [CanReadWrite Type]) a. Monad m => t -> MultiGSTT ('Settable t ': tr) m a -> MultiGSTT tr m (a, t)
- withStateAS :: forall (m :: Type -> Type) t (tr :: [CanReadWrite Type]) a. Monad m => t -> MultiGSTT ('Settable t ': tr) m a -> MultiGSTT tr m (a, t)
- withStateSA :: forall (m :: Type -> Type) t (tr :: [CanReadWrite Type]) a. Monad m => t -> MultiGSTT ('Settable t ': tr) m a -> MultiGSTT tr m (t, a)
- withStateA :: forall (m :: Type -> Type) t (tr :: [CanReadWrite Type]) a. Monad m => t -> MultiGSTT ('Settable t ': tr) m a -> MultiGSTT tr m a
- withStateS :: forall (m :: Type -> Type) t (tr :: [CanReadWrite Type]) a. Monad m => t -> MultiGSTT ('Settable t ': tr) m a -> MultiGSTT tr m t
- withState_ :: forall (m :: Type -> Type) t (tr :: [CanReadWrite Type]) a. Monad m => t -> MultiGSTT ('Settable t ': tr) m a -> MultiGSTT tr m ()
- without :: forall (m :: Type -> Type) (tr :: [CanReadWrite Type]) a (ct :: CanReadWrite Type). Monad m => MultiGSTT tr m a -> MultiGSTT (ct ': tr) m a
- mGetRaw :: forall (m :: Type -> Type) (ts :: [CanReadWrite Type]). Monad m => MultiGSTT ts m (HListM ts)
- mSetRaw :: forall (m :: Type -> Type) (ts :: [CanReadWrite Type]). Monad m => HListM ts -> MultiGSTT ts m ()
- mGetRawR :: forall (m :: Type -> Type) (ts :: [CanReadWrite Type]). (Monad m, HListMGettableClass ts) => MultiGSTT ts m (HList (HListMGettableOnly ts))
- mapMultiGSTT :: forall ts (cts :: [CanReadWrite Type]) m a m' a'. ts ~ HListM cts => (m (a, ts) -> m' (a', ts)) -> MultiGSTT cts m a -> MultiGSTT cts m' a'
Documentation
newtype MultiGSTT (ts :: [CanReadWrite Type]) (m :: Type -> Type) a Source #
Constructors
| MultiGSTT | |
Fields
| |
Instances
type MultiGSTTNull = MultiGSTT ('[] :: [CanReadWrite Type]) Source #
MonadMulti classes
type ContainsReader = HListMContains 'GettableFlag Source #
type ContainsState = HListMContains 'SettableFlag Source #
type ContainsWriter = HListMContains 'TellableFlag Source #
class Monad m => MonadMultiReader a (m :: Type -> Type) where Source #
All methods must be defined.
The idea is: Any monad stack is instance of MonadMultiReader a, iff
the stack contains a MultiReaderT x with a element of x.
Instances
| (MonadTrans t, Monad (t m), MonadMultiReader a m) => MonadMultiReader a (t m) Source # | |
Defined in Control.Monad.Trans.MultiReader.Class | |
| (Monad m, ContainsType a c) => MonadMultiReader a (MultiReaderT c m) Source # | |
Defined in Control.Monad.Trans.MultiReader.Lazy Methods mAsk :: MultiReaderT c m a Source # | |
| (Monad m, ContainsType a c) => MonadMultiReader a (MultiReaderT c m) Source # | |
Defined in Control.Monad.Trans.MultiReader.Strict Methods mAsk :: MultiReaderT c m a Source # | |
| (Monad m, ContainsType a r) => MonadMultiReader a (MultiRWST r w s m) Source # | |
Defined in Control.Monad.Trans.MultiRWS.Lazy | |
| (Monad m, ContainsType a r) => MonadMultiReader a (MultiRWST r w s m) Source # | |
Defined in Control.Monad.Trans.MultiRWS.Strict | |
class (Monad m, Monoid a) => MonadMultiWriter a (m :: Type -> Type) where Source #
Instances
class Monad m => MonadMultiGet a (m :: Type -> Type) where Source #
In contrast to MonadMultiReader, MonadMultiGet is defined for State too, so it corresponds to read-access of any kind.
Note however that for MultiRWS, only the values from the state part can
be accessed via MonadMultiGet, due to limitations of the design of
MultiRWS and of the type system. This is issue is resolved in the
MultiGST type.
Instances
class MonadMultiGet a m => MonadMultiState a (m :: Type -> Type) where Source #
Instances
run-functions
runMultiGSTTNil :: Monad m => MultiGSTT ('[] :: [CanReadWrite Type]) m a -> m a Source #
runMultiGSTTNil_ :: Monad m => MultiGSTT ('[] :: [CanReadWrite Type]) m a -> m () Source #
with-functions
withReader :: forall (m :: Type -> Type) t (tr :: [CanReadWrite Type]) a. Monad m => t -> MultiGSTT ('Gettable t ': tr) m a -> MultiGSTT tr m a Source #
withReader_ :: forall (m :: Type -> Type) t (tr :: [CanReadWrite Type]) a. Monad m => t -> MultiGSTT ('Gettable t ': tr) m a -> MultiGSTT tr m () Source #
withReaders :: forall (m :: Type -> Type) (rs :: [Type]) (ts :: [CanReadWrite Type]) a. Monad m => HList rs -> MultiGSTT (AppendM (HListMReaders rs) ts) m a -> MultiGSTT ts m a Source #
withWriter :: forall t (m :: Type -> Type) (tr :: [CanReadWrite Type]) a. (Monoid t, Monad m) => MultiGSTT ('Tellable t ': tr) m a -> MultiGSTT tr m (a, t) Source #
withWriterAW :: forall t (m :: Type -> Type) (tr :: [CanReadWrite Type]) a. (Monoid t, Monad m) => MultiGSTT ('Tellable t ': tr) m a -> MultiGSTT tr m (a, t) Source #
withWriterWA :: forall t (m :: Type -> Type) (tr :: [CanReadWrite Type]) a. (Monoid t, Monad m) => MultiGSTT ('Tellable t ': tr) m a -> MultiGSTT tr m (t, a) Source #
withWriterW :: forall t (m :: Type -> Type) (tr :: [CanReadWrite Type]) a. (Monoid t, Monad m) => MultiGSTT ('Tellable t ': tr) m a -> MultiGSTT tr m t Source #
withState :: forall (m :: Type -> Type) t (tr :: [CanReadWrite Type]) a. Monad m => t -> MultiGSTT ('Settable t ': tr) m a -> MultiGSTT tr m (a, t) Source #
withStateAS :: forall (m :: Type -> Type) t (tr :: [CanReadWrite Type]) a. Monad m => t -> MultiGSTT ('Settable t ': tr) m a -> MultiGSTT tr m (a, t) Source #
withStateSA :: forall (m :: Type -> Type) t (tr :: [CanReadWrite Type]) a. Monad m => t -> MultiGSTT ('Settable t ': tr) m a -> MultiGSTT tr m (t, a) Source #
withStateA :: forall (m :: Type -> Type) t (tr :: [CanReadWrite Type]) a. Monad m => t -> MultiGSTT ('Settable t ': tr) m a -> MultiGSTT tr m a Source #
withStateS :: forall (m :: Type -> Type) t (tr :: [CanReadWrite Type]) a. Monad m => t -> MultiGSTT ('Settable t ': tr) m a -> MultiGSTT tr m t Source #
withState_ :: forall (m :: Type -> Type) t (tr :: [CanReadWrite Type]) a. Monad m => t -> MultiGSTT ('Settable t ': tr) m a -> MultiGSTT tr m () Source #
without-functions
without :: forall (m :: Type -> Type) (tr :: [CanReadWrite Type]) a (ct :: CanReadWrite Type). Monad m => MultiGSTT tr m a -> MultiGSTT (ct ': tr) m a Source #
other functions
mGetRaw :: forall (m :: Type -> Type) (ts :: [CanReadWrite Type]). Monad m => MultiGSTT ts m (HListM ts) Source #
mSetRaw :: forall (m :: Type -> Type) (ts :: [CanReadWrite Type]). Monad m => HListM ts -> MultiGSTT ts m () Source #
mGetRawR :: forall (m :: Type -> Type) (ts :: [CanReadWrite Type]). (Monad m, HListMGettableClass ts) => MultiGSTT ts m (HList (HListMGettableOnly ts)) Source #
mapMultiGSTT :: forall ts (cts :: [CanReadWrite Type]) m a m' a'. ts ~ HListM cts => (m (a, ts) -> m' (a', ts)) -> MultiGSTT cts m a -> MultiGSTT cts m' a' Source #