Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Bug in type inference

  • Loading branch information...
commit 88c18049a2eb5c510f51bb0b220c0c195477e26f 1 parent 1e028e5
Andy Sonnenburg authored April 16, 2012
6  src/Language/Glyph/HM/InferType.hs
@@ -147,8 +147,8 @@ inferExp = go
147 147
       (psi1, c1, tau1) <- inferExp e1
148 148
       (psi2, c2, tau2) <- localApply psi1 $ inferExp e2
149 149
       alpha <- fresh
150  
-      let d = Set.map toNonnormal (c1 <> c2) <>
151  
-              Set.singleton (tau1 := tau2 :->: alpha)
  150
+      let d = Set.map toNonnormal ((psi2 $$ c1) <> c2) <>
  151
+              Set.singleton ((psi2 $$ tau1) := tau2 :->: alpha)
152 152
           psi' = psi2 $. psi1
153 153
       (c, psi) <- normalize d psi'
154 154
       gamma <- get
@@ -159,7 +159,7 @@ inferExp = go
159 159
       (c2, sigma) <- generalize c1 (psi1 $$ gamma) tau
160 160
       modify $ Map.insert x sigma
161 161
       (psi2, c3, tau') <- localApply psi1 $ inferExp e'
162  
-      let d = c2 <> c3
  162
+      let d = (psi2 $$ c2) <> c3
163 163
           psi' = psi2 $. psi1
164 164
       (c, psi) <- normalize (Set.map toNonnormal d) psi'
165 165
       return (psi $| typeVars (Map.delete x gamma), c, psi $$ tau')
4  src/Language/Glyph/Type.hs
@@ -159,7 +159,7 @@ instance NFData Type where
159 159
 type Var = Ident
160 160
 
161 161
 instance Pretty' Var where
162  
-  pretty' x = return $ pretty x {- do
  162
+  pretty' x = do
163 163
     (a, m) <- get
164 164
     case IdentMap.lookup x m of
165 165
       Nothing -> do
@@ -172,7 +172,7 @@ instance Pretty' Var where
172 172
       Just doc ->
173 173
         return doc
174 174
     where
175  
-      size = fromEnum 'Z' - fromEnum 'A' + 1 -}
  175
+      size = fromEnum 'Z' - fromEnum 'A' + 1
176 176
 
177 177
 type Record = Map Label Type
178 178
 

0 notes on commit 88c1804

Please sign in to comment.
Something went wrong with that request. Please try again.