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: fix type inference #40

Closed chsievers closed 9 years ago

chsievers commented 9 years ago

inferPrim has to apply the substitution when calling unify. Test case: \f n -> if True then n else (f (n+1))

This could really be the last one for type inference.

sdiehl commented 9 years ago

LGTM. I'll try and canonize the pathological cases for poly in the test.ml.