Permalink
Browse files

Bug in type inference

  • Loading branch information...
1 parent 1e028e5 commit 88c18049a2eb5c510f51bb0b220c0c195477e26f @sonyandy committed Apr 16, 2012
Showing with 5 additions and 5 deletions.
  1. +3 −3 src/Language/Glyph/HM/InferType.hs
  2. +2 −2 src/Language/Glyph/Type.hs
@@ -147,8 +147,8 @@ inferExp = go
(psi1, c1, tau1) <- inferExp e1
(psi2, c2, tau2) <- localApply psi1 $ inferExp e2
alpha <- fresh
- let d = Set.map toNonnormal (c1 <> c2) <>
- Set.singleton (tau1 := tau2 :->: alpha)
+ let d = Set.map toNonnormal ((psi2 $$ c1) <> c2) <>
+ Set.singleton ((psi2 $$ tau1) := tau2 :->: alpha)
psi' = psi2 $. psi1
(c, psi) <- normalize d psi'
gamma <- get
@@ -159,7 +159,7 @@ inferExp = go
(c2, sigma) <- generalize c1 (psi1 $$ gamma) tau
modify $ Map.insert x sigma
(psi2, c3, tau') <- localApply psi1 $ inferExp e'
- let d = c2 <> c3
+ let d = (psi2 $$ c2) <> c3
psi' = psi2 $. psi1
(c, psi) <- normalize (Set.map toNonnormal d) psi'
return (psi $| typeVars (Map.delete x gamma), c, psi $$ tau')
@@ -159,7 +159,7 @@ instance NFData Type where
type Var = Ident
instance Pretty' Var where
- pretty' x = return $ pretty x {- do
+ pretty' x = do
(a, m) <- get
case IdentMap.lookup x m of
Nothing -> do
@@ -172,7 +172,7 @@ instance Pretty' Var where
Just doc ->
return doc
where
- size = fromEnum 'Z' - fromEnum 'A' + 1 -}
+ size = fromEnum 'Z' - fromEnum 'A' + 1
type Record = Map Label Type

0 comments on commit 88c1804

Please sign in to comment.