//and leaves the heap adress to write to on the stack
followFs :: [FieldSelector] -> Gen()
followFs [] = tell []
-followFs [FieldHd:fs] = tell [Instr "ldc" [Lit 1] "select hd"
+followFs [FieldHd:fs] = tell [Instr "ldc" [Lit 1] "select hd"
,Instr "sub" [] "select hd"]
- >>| followFs fs
-followFs [FieldTl] = tell []
-followFs [FieldTl:fs] = tell [Instr "lda" [Lit 0] ""]
- >>| followFs fs
-followFs [FieldFst:fs] = tell [Instr "ldc" [Lit 1] "select fst"
+ >>| followFs fs
+followFs [FieldTl] = tell []
+followFs [FieldTl:fs] = tell [Instr "lda" [Lit 0] ""]
+ >>| followFs fs
+followFs [FieldFst:fs] = tell [Instr "ldc" [Lit 1] "select fst"
,Instr "sub" [] "select fst"]
>>| followFs fs
-followFs [FieldSnd:fs] = tell [Instr "lda" [Lit 0] ""]
- >>| followFs fs
-followFs [FieldSnd] = tell []
+followFs [FieldSnd:fs] = tell [Instr "lda" [Lit 0] ""]
+ >>| followFs fs
+followFs [FieldSnd] = tell []
foldVarDecl :: Int VarDecl -> Gen Int
foldVarDecl x (VarDecl _ mt k e) = g e
unify (subst s1 ta2) (subst s1 tb2) >>= \s2->
Right $ compose s2 s1
unify (TupleType (ta1,ta2)) (TupleType (tb1,tb2)) = unify ta1 tb1 >>= \s1->
- unify ta2 tb2 >>= \s2->
+ unify (subst s1 ta2) (subst s1 tb2) >>= \s2->
Right $ compose s2 s1
unify (ListType t1) (ListType t2) = unify t1 t2
unify (FuncType t1) (FuncType t2) = unify t1 t2