sdiehl / write-you-a-haskell

Building a modern functional compiler from first principles. (http://dev.stephendiehl.com/fun/)
MIT License
3.34k stars 256 forks source link

poly inference bugs #35

Closed sdiehl closed 9 years ago

sdiehl commented 9 years ago

Fix poly inference for If/Op per comments in pull request #33 .

Poly> let not x = if x then False else True
Poly> \x -> if (not x) then x else (x+1)
<<closure>> : Int -> Int
Poly> let b2i x = if x then 1 else 0
Poly> \x -> (b2i x) + x
<<closure>> : Int -> Int
Poly> (\x -> (b2i x) + x) 0
poly: Pattern match failure in do expression at Eval.hs:58:5-12
sdiehl commented 9 years ago

Fixed by pull request #37 .