summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2012-05-31 23:59:02 +1000
committerJed Barber <jjbarber@y7mail.com>2012-05-31 23:59:02 +1000
commitcbc92845f45e099f819624a169ff985650c530e6 (patch)
treefc9a9a1cbf5e726226a4eaa92753747f8bc6d0bd
parentf263985155205658e09d4a738b468fc038c7db9e (diff)
Fixed type variable substitution
-rw-r--r--Term.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Term.hs b/Term.hs
index dfcf1cf..8abdeb4 100644
--- a/Term.hs
+++ b/Term.hs
@@ -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