HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulepolysemy-zoo-0.8.2.0Haskell2010

Polysemy.Final.IO.Internal

  • 3 values
valueinterpretFinalGlobal
  1. :: Member (Final IO) r
  2. => forall x (n :: Type -> Type). e n x -> Strategic IO n x
  3. -> Sem (e ': r) a
  4. -> Sem r a
#

Like interpretFinal specialized to IO, but also tries very hard to preserve state semantics dependant on the order interpreters are run, adressing the primary issue with Final.

Semantically, interpreters written using this behave very much as though they were written using withLowerToIO. However, this does not need to spawn an interpreter thread, making it more efficient (but not any more safe.)

interpretFinalGlobal operates under the assumption that any effectful state which can't be inspected using Inspector can't contain any values. For example, the effectful state for Polysemy.runError is Either e a. The inspector for this effectful state only fails if the effectful state is a Left value, which therefore doesn't contain any values of a.

The assumption holds true for all interpreters featured in polysemy, and is presumably always true for any properly implemented interpreter. interpretFinalGlobal may throw an exception if it is used together with an interpreter that uses weave improperly.