HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Moduleeffectful-core-2.7.1.2GHC2021

Effectful.Internal.Env

  • 10 types
  • 23 values

The environment

4 declarations
datadata Env (es :: [Effect])
#

A strict (WHNF), thread local, mutable, extensible record indexed by types of kind Effect.

Warning: the environment is a mutable data structure and cannot be simultaneously used from multiple threads under any circumstances.

In order to pass it to a different thread, you need to perform a deep copy with the cloneEnv function.

Offers very good performance characteristics for most often performed operations:

  • Extending: O(n), where n is the size of the effect stack.

  • Shrinking: O(1).

  • Indexing via (:>): O(1)

  • Modification of a specific element: O(1).

  • Getting a tail: O(1).

  • Cloning: O(N), where N is the size of the Storage.

datadata Ref
#

Reference to the effect in Storage.

Constructors

Instances1Prim
  • Prim RefDefined in effectful-core-2.7.1.2 · Effectful.Internal.Env
newtypenewtype Version
#

Version of the effect.

Instances4Eq, Ord, Show, Prim
  • Eq VersionDefined in effectful-core-2.7.1.2 · Effectful.Internal.Env
  • Ord VersionDefined in effectful-core-2.7.1.2 · Effectful.Internal.Env
  • Show VersionDefined in effectful-core-2.7.1.2 · Effectful.Internal.Env
  • Prim VersionDefined in effectful-core-2.7.1.2 · Effectful.Internal.Env

StorageData

Utils

Relinker

Dispatch

4 declarations
familytype family DispatchOf (e :: Effect) :: Dispatch
#

Dispatch types of effects.

Instances28DispatchOf, …

Operations

4 declarations
valuetailEnv :: Env (e ': es) -> IO (Env es)
#

Access the tail of the environment.

Modification of the effect stack

valueunconsEnv :: HasCallStack => Env (e ': es) -> IO ()
#

Shrink the environment by one data type.

The environment needs to come from consEnv, i.e. the intended usage is bracket (consEnv e f env) unconsEnv.

Note: after calling this function e from the input environment is no longer usable.

valueunreplaceEnv :: (HasCallStack, e :> es) => Env es -> IO ()
#

Remove a reference to the replaced effect.

The environment needs to come from replaceEnv, i.e. the intended usage is bracket (replaceEnv e f env) unreplaceEnv.

Note: after calling this function the input environment is no longer usable.

valuesubsumeEnv :: e :> es => Env es -> IO (Env (e ': es))
#

Reference an existing effect from the top of the stack.

valueinjectEnv :: Subset subEs es => Env es -> IO (Env subEs)
#

Construct an environment containing a permutation (with possible duplicates) of a subset of effects from the input environment.

Data retrieval and update