{- | This is just like "Control.Monad.Reader.Class" except you can access the context of any Reader in the monad stack instead of just the top one as long as the context types are different. If two or more readers in the stack have the same context type you get the context of the top one. -}{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, OverlappingInstances #-}moduleControl.Monad.ContextwhereimportControl.Monad.ReaderimportControl.Monad.Error-- | Same as 'MonadReader' but without functional dependency so the same monad can have multiple contexts with different typesclass(Monadm)=>Contextxmwherecontext::mx-- ^ Get the context in the Reader in the monad stack that has @x@ context type. Analogous to 'ask'.push::(x->x)->ma->ma-- ^ Push new context in the Reader in the monad stack that has @x@ context type. Analogous to 'local'instance(Monadm)=>Contextx(ReaderTxm)wherecontext=askpush=localinstance(Contextxm)=>Contextx(ReaderTrm)wherecontext=liftcontextpushfm=ReaderT(pushf.runReaderTm)instance(Contextxm,Errore)=>Contextx(ErrorTem)wherecontext=liftcontextpushf=ErrorT.pushf.runErrorT