mirror of
https://github.com/unisonweb/unison.git
synced 2024-11-14 07:51:12 +03:00
generalizeExistentials ported
This commit is contained in:
parent
5644f47622
commit
3e11768fcf
@ -445,13 +445,13 @@ annotateLetRecBindings letrec =
|
|||||||
-- | Apply the context to the input type, then convert any unsolved existentials
|
-- | Apply the context to the input type, then convert any unsolved existentials
|
||||||
-- to universals.
|
-- to universals.
|
||||||
generalizeExistentials :: Var v => Context v loc -> Type v loc -> Type v loc
|
generalizeExistentials :: Var v => Context v loc -> Type v loc -> Type v loc
|
||||||
generalizeExistentials ctx t = error "todo"
|
generalizeExistentials ctx t =
|
||||||
-- foldr gen (apply ctx t) (unsolved ctx)
|
foldr gen (apply ctx t) (unsolved ctx)
|
||||||
--where
|
where
|
||||||
-- gen e t =
|
gen e t =
|
||||||
-- if TypeVar.Existential e `ABT.isFreeIn` t
|
if TypeVar.Existential e `ABT.isFreeIn` t
|
||||||
-- then Type.forall (TypeVar.Universal e) (ABT.subst (TypeVar.Existential e) (Type.universal e) t)
|
then Type.forall (loc t) (TypeVar.Universal e) (ABT.substInheritAnnotation (TypeVar.Existential e) (Type.universal e) t)
|
||||||
-- else t -- don't bother introducing a forall if type variable is unused
|
else t -- don't bother introducing a forall if type variable is unused
|
||||||
|
|
||||||
-- | Check that under the given context, `e` has type `t`,
|
-- | Check that under the given context, `e` has type `t`,
|
||||||
-- updating the context in the process.
|
-- updating the context in the process.
|
||||||
|
Loading…
Reference in New Issue
Block a user