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

Modulepolysemy-plugin-0.4.5.3Haskell2010

Polysemy.Plugin.Fundep.Unification

Synopsis
datadata SolveContext

The context in which we're attempting to solve a constraint.

Constructors

  • FunctionDef (Set TyVar)

    In the context of a function definition. The Set TyVar is all of the skolems that exist in the [G] constraints for this function.

  • InterpreterUse Bool (Set TyVar)

    In the context of running an interpreter. The Bool corresponds to whether we are only trying to solve a single Member constraint right now. If so, we *must* produce a unification wanted.

Instances3Eq, Ord, Outputable
  • Eq SolveContextDefined in polysemy-plugin-0.4.5.3 · Polysemy.Plugin.Fundep.Unification
  • Ord SolveContextDefined in polysemy-plugin-0.4.5.3 · Polysemy.Plugin.Fundep.Unification
  • Outputable SolveContextDefined in polysemy-plugin-0.4.5.3 · Polysemy.Plugin.Fundep.Unification

Depending on the context in which we're solving a constraint, we may or may not want to force a unification of effects. For example, when defining user code whose type is Member (State Int) r => ..., if we see get :: Sem r s, we should unify s ~ Int.

valueunify
  1. :: SolveContext
  2. -> Type

    wanted

  3. -> Type

    given

  4. -> Maybe Subst

Determine whether or not two effects are unifiable.

All free variables in [W] constraints are considered skolems, and thus are not allowed to unify with anything but themselves. This properly handles all cases in which we are unifying ambiguous [W] constraints (which are true type variables) against [G] constraints.

newtypenewtype OrdType

Types don't have Eq or Ord instances by default, even though there are functions in GHC that implement these operations. This newtype gives us those instances.

Constructors

Instances2Eq, Ord
  • Eq OrdTypeDefined in polysemy-plugin-0.4.5.3 · Polysemy.Plugin.Fundep.Unification
  • Ord OrdTypeDefined in polysemy-plugin-0.4.5.3 · Polysemy.Plugin.Fundep.Unification