class (Monad m, HasSource tag r m) => HasReader (tag :: k) r (m :: Type -> Type) | tag m -> r whereReader capability
An instance should fulfill the following laws. At this point these laws are not definitive, see https://github.com/haskell/mtl/issues/5.
k <*> ask @t = ask @t <**> kask @t *> m = m = m <* ask @tlocal @t f (ask @t) = fmap f (ask @t)local @t f . local @t g = local @t (g . f)local @t f (pure x) = pure xlocal @t f (m >>= \x -> k x) = local @t f m >>= \x -> local @t f (k x)reader @t f = f <$> ask @tMethods
local_ :: Proxy# tag -> (r -> r) -> m a -> m aFor technical reasons, this method needs an extra proxy argument. You only need it if you are defining new instances of
HasReader. Otherwise, you will want to uselocal. Seelocalfor more documentation.reader_ :: Proxy# tag -> (r -> a) -> m aFor technical reasons, this method needs an extra proxy argument. You only need it if you are defining new instances of
HasReader. Otherwise, you will want to usereader. Seereaderfor more documentation.
Instances12HasSource, HasReader, Reified, …
HasState tag r m => HasReader tag r (ReadStatePure m)Defined in capability-0.5.0.1 · Capability.Reader.Internal.Strategies · orphanMonadReader r m => HasReader tag r (MonadReader m)Defined in capability-0.5.0.1 · Capability.Reader.Internal.Strategies · orphan(HasReader tag r m, MonadTransControl t, Monad (t m)) => HasReader tag r (Lift (t m))Defined in capability-0.5.0.1 · Capability.Reader.Internal.Strategies · orphanLift one layer in a monad transformer stack.
(HasState tag r m, MonadMask m) => HasReader tag r (ReadState m)Defined in capability-0.5.0.1 · Capability.Reader.Internal.Strategies · orphan(Coercible from to, HasReader tag from m, forall x y. Coercible x y => Coercible (m x) (m y)) => HasReader tag to (Coerce to m)Defined in capability-0.5.0.1 · Capability.Reader.Internal.Strategies · orphanConvert the environment using safe coercion.
HasReader oldtag r m => HasReader newtag r (Rename oldtag m)Defined in capability-0.5.0.1 · Capability.Reader.Internal.Strategies · orphanRename the tag.
(forall x. Coercible (m x) (t2 (t1 m) x), Monad m, HasReader tag r (t2 (t1 m))) => HasReader tag r ((:.:) t2 t1 m)Defined in capability-0.5.0.1 · Capability.Reader.Internal.Strategies · orphanCompose two accessors.
(Monad m, Reifies s (Reified tag (HasReader tag r) m)) => HasReader tag r (Reflected s (HasReader tag r) m)Defined in capability-0.5.0.1 · Capability.Reader.Internal.Class(Monad m, Reifies s (Reified tag (HasReader tag r) m)) => HasSource tag r (Reflected s (HasReader tag r) m)Defined in capability-0.5.0.1 · Capability.Reader.Internal.Class(tag ~ field, HasField' field record v, HasReader oldtag record m) => HasReader tag v (Field field oldtag m)Defined in capability-0.5.0.1 · Capability.Reader.Internal.Strategies · orphanZoom in on the record field
fieldof typevin the environmentrecord.(tag ~ pos, HasPosition' pos struct v, HasReader oldtag struct m) => HasReader tag v (Pos pos oldtag m)Defined in capability-0.5.0.1 · Capability.Reader.Internal.Strategies · orphanZoom in on the field at position
posof typevin the environmentstruct.data Reified tag (HasReader tag r)ReifiedReader_readerSource :: Reified tag (HasSource tag r) m_local :: forall a. (r -> r) -> m a -> m a_reader :: forall a. (r -> a) -> m a