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

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Moduleeffectful-core-2.7.1.2GHC2021

Effectful.Labeled.State

Convenience functions for the Labeled State effect.

  • 2 types
  • 13 values

Effect

1 declaration

Handlers

Local

Shared

Operations

valuestateM
  1. :: (HasCallStack, Labeled label (State s) :> es)
  2. => (s -> Eff es (a, s))

    .

  3. -> Eff es a
#

Deprecated. Use a combination of get and put instead.

Apply the monadic function to the current state and return a value.

Re-exports

1 declaration
newtypenewtype Labeled (label :: k) (e :: Effect) (a :: Type -> Type) b where
#

Assign a label to an effect.

Note: labeled effects are best used together with the effectful-plugin package, as it significantly improves their usability.

The constructor is for sending labeled operations of a dynamically dispatched effect to the handler:

Example1 expression
import Effectful.Dispatch.Dynamic
Example1 expression
:{  data X :: Effect where    X :: X m Int  type instance DispatchOf X = Dynamic:}
Example1 expression
:{  runPureEff . runLabeled @"x" (interpret_ $ \X -> pure 333) $ do    send $ Labeled @"x" X:}333

Constructors

Instances2DispatchOf, StaticRep