HORIZON HASKELLDocslts/ghc-9.14.xd82dee82026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · d82dee8 · 2026-10-12

Modulecapability-0.5.0.1Haskell2010

Capability.Reader.Internal.Strategies

  • 3 types
  • Packagecapability-0.5.0.1
  • Exports3
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceStrategies.hs
newtypenewtype MonadReader (m :: Type -> Type) a
#

Derive HasSource from m's MonadReader instance.

Constructors

  • MonadReader (m a)
Instances8HasReader, HasSource, Monad, Functor, Applicative, MonadIO, …
  • MonadReader r m => HasReader tag r (MonadReader m)Defined in capability-0.5.0.1 · Capability.Reader.Internal.Strategies · orphan
  • MonadReader r m => HasSource tag r (MonadReader m)Defined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
  • Monad m => Monad (MonadReader m)Defined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
  • Functor m => Functor (MonadReader m)Defined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
  • Applicative m => Applicative (MonadReader m)Defined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
  • MonadIO m => MonadIO (MonadReader m)Defined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
  • PrimMonad m => PrimMonad (MonadReader m)Defined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
  • type PrimState (MonadReader m) = PrimState mDefined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
newtypenewtype ReadStatePure (m :: Type -> Type) a
#

Convert a pure state monad into a reader monad.

Pure meaning that the monad stack does not allow catching exceptions. Otherwise, an exception occurring in the action passed to local could cause the context to remain modified outside of the call to local. E.g.

local @tag (const r') (throw MyException)
`catch` \MyException -> ask @tag

returns r' instead of the previous value.

Note, that no MonadIO instance is provided, as this would allow catching exceptions.

See ReadState.

Constructors

  • ReadStatePure (m a)
Instances5HasReader, HasSource, Monad, Functor, Applicative
  • HasState tag r m => HasReader tag r (ReadStatePure m)Defined in capability-0.5.0.1 · Capability.Reader.Internal.Strategies · orphan
  • HasState tag r m => HasSource tag r (ReadStatePure m)Defined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
  • Monad m => Monad (ReadStatePure m)Defined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
  • Functor m => Functor (ReadStatePure m)Defined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
  • Applicative m => Applicative (ReadStatePure m)Defined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
newtypenewtype ReadState (m :: Type -> Type) a
#

Convert a state monad into a reader monad.

Use this if the monad stack allows catching exceptions.

See ReadStatePure.

Constructors

  • ReadState (m a)
Instances8HasReader, HasSource, Monad, Functor, Applicative, MonadIO, …
  • (HasState tag r m, MonadMask m) => HasReader tag r (ReadState m)Defined in capability-0.5.0.1 · Capability.Reader.Internal.Strategies · orphan
  • (HasState tag r m, MonadMask m) => HasSource tag r (ReadState m)Defined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
  • Monad m => Monad (ReadState m)Defined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
  • Functor m => Functor (ReadState m)Defined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
  • Applicative m => Applicative (ReadState m)Defined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
  • MonadIO m => MonadIO (ReadState m)Defined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
  • PrimMonad m => PrimMonad (ReadState m)Defined in capability-0.5.0.1 · Capability.Source.Internal.Strategies
  • type PrimState (ReadState m) = PrimState mDefined in capability-0.5.0.1 · Capability.Source.Internal.Strategies

Orphan instances

9 instances
  • HasState tag r m => HasReader tag r (ReadStatePure m)
  • MonadReader r m => HasReader tag r (MonadReader m)
  • (HasReader tag r m, MonadTransControl t, Monad (t m)) => HasReader tag r (Lift (t m))

    Lift one layer in a monad transformer stack.

  • (HasState tag r m, MonadMask m) => HasReader tag r (ReadState m)
  • (Coercible from to, HasReader tag from m, forall x y. Coercible x y => Coercible (m x) (m y)) => HasReader tag to (Coerce to m)

    Convert the environment using safe coercion.

  • HasReader oldtag r m => HasReader newtag r (Rename oldtag m)

    Rename 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)

    Compose two accessors.

  • (tag ~ field, HasField' field record v, HasReader oldtag record m) => HasReader tag v (Field field oldtag m)

    Zoom in on the record field field of type v in the environment record.

  • (tag ~ pos, HasPosition' pos struct v, HasReader oldtag struct m) => HasReader tag v (Pos pos oldtag m)

    Zoom in on the field at position pos of type v in the environment struct.