Last active
October 20, 2015 04:00
-
-
Save swgillespie/4f925ee12edc09e2fd19 to your computer and use it in GitHub Desktop.
occurs check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prelude> let x = x x | |
<interactive>:2:9: | |
Occurs check: cannot construct the infinite type: t1 ~ t -> t1 | |
Relevant bindings include x :: t -> t1 (bound at <interactive>:2:5) | |
In the expression: x x | |
In an equation for ‘x’: x = x x | |
# let rec x = x x;; | |
Error: This expression has type 'a -> 'b | |
but an expression was expected of type 'a | |
The type variable 'a occurs inside 'a -> 'b | |
> let rec x = x x;; | |
let rec x = x x;; | |
------------^^^ | |
/Users/sean/Library/Developer/Xcode/DerivedData/lldb-ahryjcvbkbsloweweleakmzjotns/Build/Products/DebugClang/stdin(1,13): error FS0001: Type mismatch. Expecting a | |
'a -> 'b | |
but given a | |
'b | |
The resulting type would be infinite when unifying ''a' and ''b -> 'a' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment