-
Notifications
You must be signed in to change notification settings - Fork 657
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
elm-lang.org brought down by infinite loop in compiler #27
Comments
Thanks for the report! The server is back up, and I'll work on figuring this one out. The type you describe is recursive, not infinite (I think this is a standard distinction, not sure though). The point is that the type of The mutually recursive functions you define (
I should be detecting this and throwing an error, but I guess not in this case! Were you also seeing this behavior on functions that did not have infinite types? |
I don't think so. I'm pretty sure
I used Also, note that if you change the offending code sample to:
It doesn't crash, it just accepts the code (which Haskell rejects due to an occurs check failure). |
To clarify, I didn't use the |
Ok, makes sense. I was treating |
I found a more innocent-looking piece of code that blows up the compiler:
The problem is that the Elm compiler does not seem to implement an occurs check. Namely, when unifying types, and you have a situation like this:
This should be treated as a type error, since the substitution In general, when unifying a type variable a with type T:
Typing Haskell in Haskell, section 6 describes unification and matching algorithms pretty nicely. |
I am pretty certain you are correct, and I believe this can be corrected pretty easily. I'll take a look now. I'll take a read through the link you provided to see if I can clean things up / find other mistakes! |
Ok, fixed and pushed to master! |
Released! |
I was playing around in elm-lang.org's interactive IDE, trying to make a draggable circle. In particular, I was going for something like this:
Then, use
foldp
andlift2 (,) position isDown
to feed theDragCircle
automaton.I ended up crashing the server. I compiled elm-server locally and reproduced the hang and leak. Here's a minimal code sample triggering the leak:
I suppose such hangs could be avoided using System.Timeout in elm-server, e.g.:
I don't know if happstack-server does anything to time out response generation or not.
Another thing you could do is set the maximum amount of memory the runtime system may allocate, by adding this to the .cabal file:
This way, if elm-server blows up again, it doesn't bring the whole system to a crawl.
The text was updated successfully, but these errors were encountered: