From cbc92845f45e099f819624a169ff985650c530e6 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 31 May 2012 23:59:02 +1000 Subject: Fixed type variable substitution --- Term.hs | 8 ++++++-- 1 file 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 -- cgit