Note [Type vs Constraint for error ids]
We need both iMPOSSIBLE_ERROR_ID :: forall (r::RuntimeRep) (a::TYPE r). Addr# -> a iMPOSSIBLE_CONSTRAINT_ERROR_ID :: forall (r::RuntimeRep) (a::CONSTRAINT r). Addr# -> a because we don't have polymorphism over TYPE vs CONSTRAINT. You might wonder if iMPOSSIBLE_CONSTRAINT_ERROR_ID is ever needed in practice, but it is: see #22634. So: * In Control.Exception.Base we have impossibleError :: forall (a::Type). Addr# -> a impossibleConstraintError :: forall (a::Type). Addr# -> a This generates the code for `impossibleError`, but because they are wired in the interface file definitions are never looked at (indeed, they don't even get serialised). * In this module GHC.Core.Make we define /wired-in/ Ids for iMPOSSIBLE_ERROR_ID iMPOSSIBLE_CONSTRAINT_ERROR_ID with the desired above types (i.e. runtime-rep polymorphic, and returning a constraint for the latter. Much the same plan works for aBSENT_ERROR_ID and aBSENT_CONSTRAINT_ERROR_ID ************************************************************************ * * aBSENT_ERROR_ID * * ************************************************************************
References 0
This Note does not link to any other.
Referenced by 5
- GHC.Core.Make call site ×4
- TYPE and CONSTRAINT] aka Note [Type vs Constraint GHC.Builtin.Types.Prim