

Switching from imperative to functional programming with games in Elm - Dobiasd
https://github.com/Dobiasd/elm-articles/blob/master/switching_from_imperative_to_functional_programming_with_games_in_Elm.md
This is the first time I wrote an article not in my native language. If something sounds stupid or the content is nonsense in your opinion, I would be glad if you let me know. :)
======
quchen
(I posted this same answer in the r/Haskell crosspost, I think it may be
useful here as well.)

I'm the "David" the article talks about. The backstory is this:

I spent a year abroad, but we were regularly talking over XMPP. One day, Dobi
gave me a link to an online book that has a sun saying "holy shit" on the
front page. It was
[http://learnyouahaskell.com/](http://learnyouahaskell.com/), and it spoke of
some obscure language I had never heard of. But I found the pictures funny so
I started reading the first chapter.

A month later, Dobi had long lost interest in Haskell himself, but I was
hooked. Every "wow FP is awesome moment" was forcibly shared with him. I soon
began to talk about ApplicativeMonoidMonadFunctor and how neat these
abstractions are.

Since that one day when I received the LYAH link, it's marked "Dobi shows
David Haskell day" in my calendar, this has continued: I'm learning Haskell,
and everything cool is thrown at Dobi. He even made a second attempt at
learning Haskell, but due to its inaccessibility (relative to Elm), he lost
interest again.

Then, a couple of weeks ago, he asks me whether I knew Elm. I said yes, but as
someone who now uses Haskell as his main language, I thought of Elm as a toy.
Today I see how this was wrong: Elm is an excellent language, maybe not to
write a scalable webserver, but it gets a few things right that Haskell
doesn't:

\- Elm is very accessible.

\- Even simple and small programs can have cool output, and by that I don't
mean conceptually cool but you-can-show-your-friends cool. Getting positive
feedback is really motivating in the beginning when you're not quite sure
whether the language is useful yet.

\- Elm has Haskell-like syntax, and is of similar semantic structure. It has
recursive lists, fold, map, Maybe and all those other Haskell Prelude things.

\- No category-like abstractions (as a result of not having typeclasses,
mostly). Monads are pretty abstract, and are pretty infamous among people that
don't know them. This significantly lowers the barrier of entry.

The crucial thing is the similarity to Haskell: Elm is a much better gateway
drug to Haskell-like languages than say XMonad (which is pretty geeky) or
other nice little things. Once you can write Elm, a Monad is just another
addition to a language you already know how to move in, and you can learn to
include it in your programming instead of requiring it in the first place. I
think instead of having a "beginner-friendly monomorphic Prelude" we should
have generalized the crap out of Prelude (Foldable, Traversable, all those
things go in) and recommended Elm to newcomers if they have problems with
Haskell.

