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!
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. 😭
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:
Top comments (3)
Thanks for sharing this! I really enjoy reading the articles that you write. Elm is intimidating when you first approach it because it appears that there is lots of documentation missing, but I am realizing that you're supposed to go straight to the source code to really understand Elm. Your articles were definitely a major factor in helping me reach that conclusion!
Yes, that's one good way to get better at any programming language. To read well written code.
I loled at