Elm's compiler hints

Dwayne Crooks - Jul 25 '19 - - Dev Community

When you run elm init it gives you a link that you can go to and read all about elm init to your heart's desire. 😍

Previously, it used to be a web page. A seemingly lonely web page not linked to anything. I'd usually wonder, "Where could I get more information like this?" 🤔

Occasionally, I'd do something heretical in Elm like variable shadowing and I'd be pointed to another one of those lonely web pages to get a lengthy talk from father Evan. 😬 And again I'd wonder "How can I do more bad things like that and get more information like this?" 😈

Then yesterday happened.

I was reading An Introduction to Functional Programming Through Lambda Calculus and I decided to try to write the self-application function in Elm and boom:

---- Elm 0.19.0 ----------------------------------------------------------------
Read <https://elm-lang.org/0.19.0/repl> to learn more: exit, help, imports, etc.
--------------------------------------------------------------------------------
> selfApply = \s -> s s
-- INFINITE TYPE ----------------------------------------------------------- elm

I am inferring a weird self-referential type for s:

3| selfApply = \s -> s s
                ^
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

Staring at this type is usually not so helpful, so I recommend reading the hints
at <https://elm-lang.org/0.19.0/infinite-type> to get unstuck!
Enter fullscreen mode Exit fullscreen mode

When I navigated to the link, https://elm-lang.org/0.19.0/infinite-type, this time it redirected to a Markdown file. After reading it I went one directory up.

I had discovered the hidden jewels. 😭

Yes

See for yourself, hints.

Disclaimer: I know that Evan's intention is that you'd discover these hints as needed when you actually get into problems and at the point you're ready to digest the information. So please keep in mind that you don't need to read this stuff all at once to be productive in Elm.

Mentioned in this post:

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player