Skip to content
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 hangs on infinite type in badly written foldl lambda #1700

Open
drewwestphal opened this issue May 11, 2018 · 1 comment
Open

Compiler hangs on infinite type in badly written foldl lambda #1700

drewwestphal opened this issue May 11, 2018 · 1 comment

Comments

@drewwestphal
Copy link

Referencing #1240 here as many similar (largely closed) issues reference it. Noted that @evancz suggested creating new issues in most cases, so I am doing so rather than piling on there--hope that is desired.

This causes the compiler to hang on 0.18.0 on a mac. (Also hangs elm reactor.)

listUnique lst =
    List.foldr
        (\elem uniq ->
            if List.member elem uniq then
                uniq
            else
                uniq :: elem
        )
        []
        lst

By breaking out the lambda into its own function (suggested on the elm slack), the compiler detects and errors on an infinite type (see here for that example)

@rtfeldman
Copy link
Member

Quick note that this is still reproducible in 0.19, on the version of the binary that fixes #1743 (I cannot reproduce that issue, but I can still reproduce this one).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants