HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduleeffectful-core-2.7.1.2GHC2021

Effectful.Labeled

Labeled effects.

Any effect can be assigned multiple labels so you have more than one available simultaneously.

Contents
  1. Effect
  2. Handlers
  3. Operations
Synopsis

Effect

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

Handlers

Operations

valuelabeled
  1. :: (HasCallStack, Labeled label e :> es)
  2. => Eff (e ': es) a

    The action using the effect.

  3. -> Eff es a

Bring an effect into scope without a label.

Useful for running code written with the non-labeled effect in mind.