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

Unification fail in type checker #107

Closed Abhiroop closed 4 years ago

Abhiroop commented 4 years ago

When attempting to run the type checker on the example given in the repo with factorial, I run into a typechecker error:

Poly> let fact = fix (\fact -> \n -> if (n == 0) then 1 else  ( n * ( fact (n-1) ) )    )
Cannot unify types:
    Int
with
    Int -> d

According to the book this should spit out the correct type.

simonvpe commented 3 years ago

I'm getting the same error on chapter 7, you closed this @Abhiroop - did you find an answer?