1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Generalize Substitution over the name type.

This commit is contained in:
Rob Rix 2019-10-11 11:38:38 -04:00
parent 6fa4a01c80
commit 7e51f43451
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -133,7 +133,7 @@ runFile eval file = traverse run file
(subst, t) <- m
modify @(Heap Name (Type Name)) (fmap (Set.map (substAll subst)))
pure (substAll subst <$> t))
. runState (mempty :: Substitution)
. runState (mempty :: (Substitution Name))
. runReader (filePath file)
. runReader (fileSpan file)
. runFail
@ -207,9 +207,9 @@ unify t1 t2
| t1 == t2 = pure ()
| otherwise = modify (<> Set.singleton (t1 :===: t2))
type Substitution = IntMap.IntMap (Type Name)
type Substitution name = IntMap.IntMap (Type name)
solve :: (Carrier sig m, Member (State Substitution) sig, MonadFail m) => Set.Set Constraint -> m ()
solve :: (Carrier sig m, Member (State (Substitution Name)) sig, MonadFail m) => Set.Set Constraint -> m ()
solve cs = for_ cs solve
where solve = \case
-- FIXME: how do we enforce proper subtyping? row polymorphism or something?