diff options
author | Jed Barber <jjbarber@y7mail.com> | 2012-05-31 23:59:02 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2012-05-31 23:59:02 +1000 |
commit | cbc92845f45e099f819624a169ff985650c530e6 (patch) | |
tree | fc9a9a1cbf5e726226a4eaa92753747f8bc6d0bd | |
parent | f263985155205658e09d4a738b468fc038c7db9e (diff) |
Fixed type variable substitution
-rw-r--r-- | Term.hs | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -96,8 +96,12 @@ substitute (tymap,vmap) term = then TConst a (snd x) else TConst a ty (TApp a b) -> TApp (typesub x a) (typesub x b) - (TAbs v a) -> TAbs v (typesub x a) - (TVar v) -> TVar v) + (TAbs (TVar (Var n ty)) a) -> if (ty == (TypeVar . fst $ x)) + then TAbs (TVar (Var n (snd x))) (typesub x a) + else TAbs (TVar (Var n ty)) (typesub x a) + (TVar (Var n ty)) -> if (ty == (TypeVar . fst $ x)) + then TVar (Var n (snd x)) + else TVar (Var n ty)) varsub = (\x y -> case y of |