th-typegraph-0.24: Graph of the subtype relation

Safe HaskellSafe
LanguageHaskell2010

Language.Haskell.TH.TypeGraph.HasState

Description

MonadState without the function dependency m -> s.

Synopsis

Documentation

class HasState s m where Source

This class allows you to access bits of the State by type, without knowing exactly what the overall state type is. For example:

typeGraphEdges :: (DsMonad m, MonadReader TypeGraph m, HasState (Set TGV) m, HasState (Map Type (E Type)) m) => ...

This will work as long as the two HasState instances exist for whatever the actual State type is. It still can't reach down into nested StateT monads, you may need to use lift for that.

Methods

getState :: m s Source

modifyState :: (s -> s) -> m () Source

Instances

(Monad m, Monoid w, HasState s m) => HasState s (WriterT w m) Source 
(Monad m, HasState s m) => HasState s (ReaderT r m) Source 
Monad m => HasState s (StateT s m) Source 
(Monad m, Monoid w) => HasState s (RWST r w s m) Source 
Monad m => HasState (Map Type (E Type)) (StateT TypeInfo m) Source