Note [Deep skolemisation]
deeplySkolemise decomposes and skolemises a type, returning a type
with all its arrows visible (ie not buried under foralls)
Examples:
deeplySkolemise (Int -> forall a. Ord a => blah)
= ( wp, [a], [d:Ord a], Int -> blah )
where wp = \x:Int. /\a. \(d:Ord a). <hole> x
deeplySkolemise (forall a. Ord a => Maybe a -> forall b. Eq b => blah)
= ( wp, [a,b], [d1:Ord a,d2:Eq b], Maybe a -> blah )
where wp = /\a.\(d1:Ord a).\(x:Maybe a)./\b.\(d2:Ord b). <hole> x
In general,
if deeplySkolemise ty = (wrap, tvs, evs, rho)
and e :: rho
then wrap e :: ty
and 'wrap' binds tvs, evs
ToDo: this eta-abstraction plays fast and loose with termination,
because it can introduce extra lambdas. Maybe add a `seq` to
fix this References 0
This Note does not link to any other.
Referenced by 2
- Deep subsumption GHC.Tc.Utils.Unify
- GHC.Tc.Utils.Unify call site