from Hacker News

Elm for the Front End, Right Now

by listrophy on 11/23/16, 9:26 PM with 77 comments

  • by kcarnold on 11/24/16, 12:29 AM

    I really want to like Elm. When I'm writing JS/React code, I sometimes think "this would be so much nicer in Elm!" - especially for architectural issues. But the few times I’ve actually tried doing something in it, I find that the parts of what I want to do that fit cleanly within Elm’s walls are really nice, but the parts that don’t quite fit get hard quickly. Suppose I want to do something with the DOM that doesn’t quite fit into virtual-dom’s model -- I suddenly have to make a complicated JS interop and work around things to get at the raw DOM node... whereas with React I can just hack something together, try it with users, and learn that I should actually be doing something completely different anyway. Or maybe I don’t actually know yet what I want to have happen in every possible condition? Maybe I feel this way because I just don’t have enough experience, but it may be a fundamental trade-off involved in how Elm makes it hard to do things wrong.

    Has anyone had some positive experiences with prototyping / rapid design iteration with Elm and can share some tips / encouragement?

  • by kinkdr on 11/23/16, 9:42 PM

    I wish they would stop making changes just for the shake of change. E.g. Up until 0.17 most code examples where using the prime ' character.

    With 0.18, Evan decided that using prime is bad taste, so he decided to break any code that uses it.

    Sure, it is not a big change, but it means they are not respecting user's time and it is a sign of things to come.

    Sorry for the rant.

    Edit: I hope my reply doesn't get misunderstood. I love Elm and use it in all my side projects. I think it made wonders for introducing new people to the ML world.

    Edit2: Sorry, didn't meant to make so much fuss about it. It is indeed a small thing.

  • by nmdanny on 11/24/16, 8:27 AM

    I think that Elm is a fundamentally good language, being catered towards JS developers will hopefully attract more of them to FP development. However, I feel that the language is too restricted compare to other FP languages (Haskell, Purescript, even Scala), as a result you often need to write too much boilerplate and the Elm architecture doesn't seem to fit nicely for all kinds of components.

    Which is why for now I'm looking into Purescript and GHCJS which support features such as Rank N types, generics, typeclasses, functional dependencies/type families. Even though I don't use many of those features directly, I do benefit from libraries that depend on them.

  • by rdtsc on 11/23/16, 10:40 PM

    Speaking of Elm I liked this video from Erlang Factory about using Phoenix and Elm together. They both have a functional flavors so I think it might appeal to same people:

    https://www.youtube.com/watch?v=XJ9ckqCMiKk

    The first half is about Phoenix, the second about Elm. I don't know much about front-end stuff but I did like the Elm bit as an intro, especially the debugging and nice error messages part.

  • by ggregoire on 11/23/16, 9:51 PM

    From what languages is Elm inspired? I've a Java/C#/PHP/JS background and I feel really uncomfortable with Elm syntax.
  • by leeoniya on 11/23/16, 10:05 PM

    in case anyone's wondering, it performs about the same as 0.17:

    https://rawgit.com/krausest/js-framework-benchmark/master/we...

  • by mullsork on 11/24/16, 1:35 PM

    I remember evaluating Elm and ClojueScript as an alternative to ES6 about a year and a half ago. Eventually I had to decide against both as we absolutely needed to render parts of our page server side (Google saying they'll index SPAs is a joke.)

    If I'm not mistaken this wasn't possible in Elm back then, and felt uncomfortable or even hard in ClojureScript. Has that changed?

    To be fair if I started a new project like the one I'm working at now I'd much rather use server + template for most pages and add interactivity through JS once it boots up.

  • by botexpert on 11/23/16, 10:33 PM

    why not flowtype/typescript+js es6+react+redux/mobx?

    currently a pretty nice reactive mobx-state-tree is on the frontpage of hn.