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 "applyl" type function #1602

Closed
bengolds opened this issue Jun 12, 2017 · 2 comments
Closed

Compiler Hangs on "applyl" type function #1602

bengolds opened this issue Jun 12, 2017 · 2 comments

Comments

@bengolds
Copy link

bengolds commented Jun 12, 2017

Wasn't obvious to me whether or not this was covered in Issue 1240. The following code causes the compiler to spin up to 100% resource utilization:

applyl : List (a -> a) -> a -> a
applyl fns start =
    List.foldl (\acc fn -> fn acc) start fns

Elm 0.18 on OSX and Ubuntu

@process-bot
Copy link

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@evancz
Copy link
Member

evancz commented Jul 14, 2017

With the latest version, the error is like this:

-- INFINITE TYPE -------------------------------------------------------

I am inferring a weird self-referential type for the 2nd argument to function
`foldl`:

133|     List.foldl (\acc fn -> fn acc) start fns
                                        ^^^^^
Here is my best effort at writing down the type. You will see ∞ for parts of the
type that repeat something already printed out infinitely.

    a -> ∞

Usually staring at the type is not so helpful in these cases, so definitely read
the debugging hints for ideas on how to figure this out:
<https://github.com/elm-lang/elm-compiler/blob/0.19.0/hints/infinite-type.md>

Thanks for the report!

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

No branches or pull requests

3 participants