hreader-1.0.2: Generalization of MonadReader and ReaderT using hset

Safe HaskellNone
LanguageHaskell2010

Control.Monad.HReader

Synopsis

Documentation

newtype HReaderT els m a Source

Monad transformer which is like ReaderT but for HSet only

Constructors

HReaderT 

Fields

unHReaderT :: ReaderT (HSet els) m a
 

runHReaderT :: HSet els -> HReaderT els m a -> m a Source

subHSetHReaderT :: (Monad m, Applicative m, SubHSettable els subels) => HReaderT subels m a -> HReaderT els m a Source

Run a local reader with a subset of HSet elements.

narrowHReaderT :: (Monad m, Applicative m, SubHSettable els subels) => proxy subels -> HReaderT subels m a -> HReaderT els m a Source

Convenient variant of subHSetHReaderT with proxy type to make it posible to run nested HReaderT in place without complex type declarations, e.g.

narrowHReaderT (Proxy :: Proxy '[String, Int]) $ do
  doThingsWithString
  doThingsWithInt
  doThingsWithOtherStuff -- < this will not compile