-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiler panic when unifying inner skolem with an outer unification variable #2301
Comments
Thanks for reporting this! To set expectations:
Finally, please be patient with the core team. They are trying their best with limited resources. |
If you need a quick fix, try adding a type annotation to the module-level declaration. Issue seems similar to #1839 |
Re
What's the OCaml error message? This OCaml translation compiles and runs on at least OCaml 4.13.1 and 5.0.0:
https://try.ocamlpro.com/#code/let'f'x'=!let'_g':'(($,a'-$.'unit)'-$.'unit)'='fun'h'-$.'h'x!in'x |
This is quite subtle, but the OCaml type you wrote is not actually equivalent to the one in Elm.
let f : 'a -> 'a = fun x -> x + 1 To get the fully polymorphic behavior like in Elm or Haskell, one needs to use an explicit quantifier let f x =
let g : 'a. ('a -> unit) -> unit =
fun h -> h x
in x This generates the "fantastic" error message
|
Quick Summary: The compiler crashes in compiler/src/Type/Solve.hs:206:15 when checking the body of
g
, which unifies a skolem bound in the type ofg
(a
) with a unification variable from the definition off
(the type ofx
)SSCCE
Additional Details
This should result in an error, ideally with a nice error message. The reason I even found this is that the error messages reported by both GHC and OCaml are quite poor.
Error message
The text was updated successfully, but these errors were encountered: