
How to use Elm at work - zalmoxes
http://elm-lang.org/blog/how-to-use-elm-at-work
======
the_duke
For those unfamiliar with elm:

I would sum it up as:

-) a stripped down, simplified version of Haskell

-) with a good concept for side effects

-) that compiles to Javascript

-) gearded towards writing type safe frontend code for the Browser

-) strongly nudging you towards a clean, well architected app structure (see 'the Elm Architecture').

I think it's on the tipping point right now:

if enough people jump on board, the language get's good documentation, and the
library ecosystem grows, I see a great future for Elm.

Otherwise, it will dwindle away soon into the endless annals of forgotten
languages.

~~~
david-given
I really like the look of Elm --- to me it seems to hit the sweet spot of
being enough like Haskell to be awesome while also being understandable by
humans. It also fixes some of the rougher edges of the Haskell syntax; I
vastly prefer Elm's record syntax to Haskell's, for example, which apart from
being much cleaner and obvious also avoids some of the more common Haskell
namespace traps.

The one piece I'm really looking for is server-side Elm, though. I've love the
ability to write both my client and my server in Elm. I know there are some
projects to allow Elm via node.js but they're still quite rough.

(Is anyone looking into transpiling Elm to Standard ML, so that it can be
compiled to fast native code with MLton? Because that'd be, like, really
cool.)

~~~
nilkn
Why not just use Haskell for the backend? It's really not much harder than
Elm, and it's considerably more flexible and general. Of course, it's lazy,
not strict, and you're totally right that records in Haskell suck. But my
understanding is that strictness for Elm was chosen mainly to overcome issues
with FRP, which it's now abandoned. So I'm not sure if that difference matters
anymore.

~~~
david-given
There's several reasons, one of the simplest (but not the most trivial) being
that I can't share code between the client and the server. For example, data
validation. I did a tonne of programming on GWT back in the day, and this was
something it actually did well.

Most of the other reasons boil down to Haskell not being Elm --- they work in
different ways and solve problems differently. There's always going to be
impedance mismatch between the two. (Do I solve this problem with monads or
with state-mutation functions?) This is going to use up valuable problem-
solving bandwidth which I'd rather spend making the project more awesome.

~~~
bbcbasic
> Haskell is not Elm

A service isn't a client though. They work in different ways and solve
problems differently

~~~
phamilton
They also, sometimes, solve the same problem. (Cited example: data validation)

There's value in sharing code between client and server. It may not outway the
costs, but there's definitely value in doing so.

~~~
bbcbasic
Yes true. There is the option of ghcjs on the front end, so you can do both in
Haskell. And ghcjs is very close to cbc. I think it even emulates the
threading model.

------
the_duke
The docs / language manual is emberassingly sparse right now.

The Elm dev(s?) really need to fix the Architecture Tutorial and write a
proper language handbook.

Right now, the bad docs are pretty off-putting to someone coming to the
language.

It's a shame, really, because I think Elm is great.

~~~
zalmoxes
While it's a WIP right now, Evan has been writing [http://guide.elm-
lang.org/](http://guide.elm-lang.org/)

I wish Evan allowed others to contribute to the official documentation. Right
now Elm feels more like Evan's personal project than a project that is owned
by the community.

Other then that, the community has done a good job of writing up
documentation, and Richard Feldman is working on a proper book.

~~~
justusw
That is the guide that helped me start, but is a long way to go until your
first elm-only app. IMO the biggest weakness in the elm package ecosphere is
that there is no proper solution to do url routing.

While elm-lang/navigation and evancz/url-parser get you 80% there, the
remaining 20% cause a lot of pain.

I am very optimistic that in the coming months this situation is going to
improve tremendously. If we all share more knowledge, tutorials, guides, the
whole community will win!

~~~
EduardoBautista
Yes, I have not found a way to do url pasting in a way that looks clean and
simple. It's the main thing keeping me from building big projects with Elm.

------
srpablo
While I love Elm, after the recent release that replaced Signals, it's going
to take a long time for me to bet anything with money on it. My toy app didn't
have many dependencies, but when _so much_ breaks on upgrading the runtime
it's a hard sell.

(Not to disparage the change or the work behind it! I think it was the right
call, and again, love the language and community. Just expressing, after the
last experience, that I'll wait until 1.0 since the language is still
undergoing drastic changes)

------
meddlepal
Isn't this basically the same strategy every challenger technology takes to
replacing an incumbent one? The problem is your organization has to be willing
to bet on Elm as a tool. What does the org do if you leave, get sick, or are
terminated? In many ways choosing niche technologies with esoteric syntax or
paradigms is like holding your organization hostage IMO.

Now does that mean nobody should ever choose a new language or other tool? No,
but the cost of adoption needs to be evaluated. I use Kotlin where I work
right now and I had to address the same questions initially. The argument for
Kotlin was that it's not that different than Java and most good Java
developers can pick it up easily OR Scala developers (though they might do
that begrudgingly...).

------
_Codemonkeyism
I still always think "Why don't they use mutt?" when a headline features elm.

~~~
methehack
For those of you who aren't getting the joke, this comment is not disparaging
elm (I noticed a downvote earlier), it's a reference to later day terminal
based email clients (two of which were 'elm' and 'mutt'). As in:
[http://www.guckes.net/mutt/vs.elm.html](http://www.guckes.net/mutt/vs.elm.html)

------
rattray
Shocked to see no mention of PureScript [0] on this thread, which is also a
Haskell-like language that compiles to JavaScript.

PureScript has the notable advantages of generating mostly-readable JavaScript
and working in node. [1]

[0] - [http://www.purescript.org/](http://www.purescript.org/) [1] –
[http://try.purescript.org/](http://try.purescript.org/) – click "Show JS
Output"

~~~
rattray
Here's an example of a PureScript React application:

[https://github.com/ethul/purescript-react-
example/blob/maste...](https://github.com/ethul/purescript-react-
example/blob/master/src/Main.purs)

------
fiatjaf
By Elm you mean that language that changes all its core functionalities[1]
every day? I've tried it some months ago, now when I was about to try it again
in a new project, I discovered everything I had learn is useless.

[1]: [http://elm-lang.org/blog/farewell-to-frp](http://elm-
lang.org/blog/farewell-to-frp)

~~~
danappelxx
The idea is really still the same, just the naming and structure changed a
little bit. I'm not sure why he labeled it a farewell since the core concept
is the same.

Either way, it's not like it changes every day - it just hasn't left beta yet.
This change is definitely for the better, and its usually good to make big,
beneficial changes as soon as possible rather than waiting for a 2.0 release.

------
innocentoldguy
I've never been a fan of doing front-end web programming because of my
distaste for Javascript. Elm solved that problem for me. I like the syntax,
type checking, and I've never had any code that passed the Elm compiler error
out on me in production.

I also like the functional programming aspect of Elm, and the syntax is quite
nice (similar to Haskell, only smaller and easier to learn).

I found this site useful for getting started with Elm 0.17:
[https://www.gitbook.com/book/evancz/an-introduction-to-
elm/d...](https://www.gitbook.com/book/evancz/an-introduction-to-elm/details)

------
mkawia
I wish there was a way/documentation to embed in a vanilla js app ,like with
IIFE or something instead of required the whole <div id="app"></div>

------
sotojuan
Is it me or is the bundle generated by Elm a bit too big? Maybe it's gotten
better lately but I've always thought it overkill for simple apps.

~~~
grayrest
I didn't remember this being too bad. I just checked with Elm 0.17 using the
tutorial's [1] nesting/3-gif-pair.elm as the main. Size is 209k out of elm-
make, 60k minified (closure compiler advanced), and 19k gzipped. I wouldn't
use it for validating a form field but the size seems completely reasonable
for a language runtime.

[1] [https://github.com/evancz/elm-architecture-
tutorial](https://github.com/evancz/elm-architecture-tutorial)

~~~
sotojuan
I stand corrected—thanks!

