News for hackers. Stuff that matters.
Re:Faithful Elm and the Amazing Router by supster on Thursday June 16, 2016 @09:39AM (#11915982)
It would be really cool to have an Elm type language on the backend. Elm feels like a lighter, friendlier version of Haskell.
Re:Faithful Elm and the Amazing Router by jarcane on Thursday June 16, 2016 @10:09AM (#11916185)
Whereas after spending even a day with it I found myself wanting to run screaming back to Haskell.

No typeclasses, no monads, more primitive pattern matching, no guards, use of massive nested elseif considered idiomatic ...

Simple tasks wind up feeling tedious because so many of the standard tools and patterns of any other ML language are simple missing completely. The result feels like trying to work with one of those random toy Lisps people make in a weekend and throw up on Github.

It frustrates me, because in theory I do like the concept of the Elm architecture, I love ML-style type systems, and I work with reactive programming every day in ClojureScript. But the language it's attached to is so incomplete that it quickly just becomes a pain.

Re:Faithful Elm and the Amazing Router by noelwelsh on Thursday June 16, 2016 @10:21AM (#11916268)
That's exactly the dividing line I see in those who love Elm and those who don't. People coming from Ruby / JS backgrounds appreciate a modern type system and it isn't so different from languages they are used to that it is hard to get going. People already used to modern functional programming miss the abstractions they are used to that Elm doesn't provide. I find this really interesting. As a community we don't give enough attention to the sociological aspects of programming. You can see similar things in the adoption of languages like Go and Elixir.
Re:Faithful Elm and the Amazing Router by lolive on Thursday June 16, 2016 @11:14AM (#11916666)
(Sorry for my poor english but i need some clarification) Do you put Go, Elixir and Elm is the same bag, i.e langages a step further JS in term of abstraction, i.e langages easy to understand when you come from plain JS? And then, you put Purescript and Haskell in another bag, i.e langages with advanced abstractions absent from "casual" langages, i.e langages requiring a lot of effort to learn? Did I summarize your idea correctly?
Re:Faithful Elm and the Amazing Router by a-saleh on Thursday June 16, 2016 @12:10PM (#11917052)
I think understood the Elm/Haskell/Purescript, i.e:

Javascript dev sees Elm and might think "Wow,a type-system and it is awesome, didn't expect that"

Haskell dev sees Elm and might think "I am missing so many features with these types" and consider something else, probably pure-script, that has similar toolbelt.

Not sure about the rest though.

Re:Faithful Elm and the Amazing Router by noelwelsh on Thursday June 16, 2016 @05:22PM (#11918978)
a-saleh is correct. Regarding Go and Elixir, I think Ruby / Python seem them and think "wow, I can program in a familiar style and I get performance and concurrency!" Haskell etc. people look at them and think "this smells."
Re:Faithful Elm and the Amazing Router by pka on Thursday June 16, 2016 @10:32AM (#11916352)
Look no further! Try Purescript. It's basically Haskell (albeit strictly evaluated) and has everything you listed, plus a record system I really wish Haskell would adopt.

I'm currently using it in production with purescript-thermite, a thin wrapper over React, and it's worked out great.

Elm is great for people coming from JS, but not so much for people coming from Haskell.

Re:Faithful Elm and the Amazing Router by jweir on Thursday June 16, 2016 @12:37PM (#11917220)
Have you looked at Reason from Facebook? It is a syntax for OCAML that is a bit simpler - https://facebook.github.io/reason/
Re:Faithful Elm and the Amazing Router by masklinn on Thursday June 16, 2016 @09:49AM (#11916047)
MLs are fairly close I would think, Elm is syntactically very similar to Haskell but semantically it feels closer to SML or OCaml (without the O part)
Re:Faithful Elm and the Amazing Router by vog on Thursday June 16, 2016 @11:15AM (#11916687)
That was my first thought, too: Elm is quite similar to OCaml, so why not using OCaml in the backend? With all that server-side stuff around MirageOS, you can not only build a server app, but a full server VM within OCaml.

On the other hand, OCaml also targets JavaScript coding in the browser, via js_of_ocaml or the newer bucklescript.

I would be very interested in a comparison of client-side development with OCaml+js_of_ocaml (or OCaml+bucklescript) versus Elm.

Re:Faithful Elm and the Amazing Router by weavie on Thursday June 16, 2016 @09:53AM (#11916066)
Yes. SML really deserves a lot more love.
Re:Faithful Elm and the Amazing Router by dreamdu5t on Thursday June 16, 2016 @01:02PM (#11917369)
There is one: PureScript. You can build node apps with it and use it with webpack. There's even an Elm-like UI library https://github.com/alexmingoia/purescript-pux
Re:Faithful Elm and the Amazing Router by jjnoakes on Thursday June 16, 2016 @10:02AM (#11916137)
I'm toying around with PureScript on node. It's not too bad.
Re:Faithful Elm and the Amazing Router by not-much-io on Thursday June 16, 2016 @09:57AM (#11916096)
From what I understand Elm is planned to target Node eventually. However the language is pretty young right now and the main work is going into making client side Elm the best it can be. The language author doesn't want to branch out too far.
Re:Faithful Elm and the Amazing Router by hibikir on Thursday June 16, 2016 @10:08AM (#11916183)
Not quite: It's planned to target Beam, Erlang's VM. It's an easy fit for Elm. Still, not going to get done any time soon.
Re:Faithful Elm and the Amazing Router by ryanplant-au on Thursday June 16, 2016 @11:12AM (#11916656)
Elm on Beam would be some kind of beautiful dream.
Re:Faithful Elm and the Amazing Router by twoquestions on Thursday June 16, 2016 @11:06AM (#11916625)
Do you have a source for this? I'd be interested in their reasoning.

You'd think Beam would be a very different compile target than JS, and it seems weird to make such a huge change without very good reason.

Re:Faithful Elm and the Amazing Router by pmarreck on Thursday June 16, 2016 @11:18AM (#11916704)
I think "massive concurrency" and "bulletproof uptimes" are pretty good reasons. Plus that would then allow Elm on both client and server.

The Elm folks have been fairly buddy-buddy with the Elixir/Phoenix folks, so this doesn't surprise me

Re:Faithful Elm and the Amazing Router by twoquestions on Thursday June 16, 2016 @12:49PM (#11917294)
That sounds amazing.

It makes my heart sing that a different VM than JVM or .Net is gaining more traction, and as a static types fan it makes me happy that a statically typed language may be getting on Beam.

Re:Faithful Elm and the Amazing Router by adam_albrecht on Thursday June 16, 2016 @03:36PM (#11918329)
Richard Feldman (who works with Evan Czaplicki at NoRedInk) mentioned it in the Elm slack channel.

http://i.imgur.com/pqk9oMl.png

It will definitely be a very different compile target. But Elm really doesn't take any inspiration from Javascript, so I don't think it will change much about the fundamentals of the language. Of course they'll need to add capabilities for concurrency, OTP, etc.

Re:Faithful Elm and the Amazing Router by knewter on Thursday June 16, 2016 @11:29AM (#11916770)
I think the compile target is basically not a big problem, and there's been explicit work to make the Browser just one Platform. Also, see the `Process` module in the core docs for a hint of the future, regardless of where it lands (this would also work well for WebWorkers etc, and is handled right now by a naive scheduler). Concern over the compile target should be super low - if you've built a language of sorts, you should have a feel for how it's not that big of a deal to tweak the target.
Re:Faithful Elm and the Amazing Router by jtwebman on Thursday June 16, 2016 @11:19AM (#11916709)
This is a great idea as Beam doesn't force typing like JavaScript so it would be a great add. I wonder how they are going to tie in OTP?
Re:Faithful Elm and the Amazing Router by TheWiseOne on Thursday June 16, 2016 @12:47PM (#11917279)
F# might be worth considering. You can also target JS by using a compiler like Fable (http://fsprojects.github.io/Fable/) or FunScript (http://funscript.info/).
Re:Faithful Elm and the Amazing Router by clarus on Thursday June 16, 2016 @10:45AM (#11916440)
You can get a "kind of Elm" experience on the backend with Flow and JavaScript / NodeJs. The type system of Flow is not as strict as Elm, but you have the main parts (including disjoint unions) and can use existing JavaScript code. With React and Redux you also get a similar framework for the frontend.
Re:Faithful Elm and the Amazing Router by BenoitP on Thursday June 16, 2016 @04:33PM (#11918675)
I have been thinking about toying with JVM's Graal compiler (JIT and customizeable deopts for the price of an interpreter). But with a language that has few corner cases. I was thinking maybe regexes, or brainfuck, or QBasic.

I'd just looove to try and put Elm on the JVM, but I just can't at the moment.

Re:Faithful Elm and the Amazing Router by kawera on Thursday June 16, 2016 @10:48AM (#11916472)
Elixir seems a good candidate.
Re:Faithful Elm and the Amazing Router by nilkn on Thursday June 16, 2016 @10:56AM (#11916538)
I'm not sure. I do think Elixir is a great language given its goals, but it's very dynamic, whereas Elm is strongly statically typed.
Re:Faithful Elm and the Amazing Router by rdtsc on Thursday June 16, 2016 @11:22AM (#11916728)
Elixir and Erlang have a type checker as well. Not Hindley–Milner but one called "success typing" and is checked by a tool called Dialyzer. It is rather good actually:

http://learnyousomeerlang.com/dialyzer

But is still optional to compile. The more precise and better the type annotations, the more helpful it is. If it can deduce that some inconsistency or type error occurring it will let user know. If it is not sure, it won't say anything.

Another point is because of isolated process heaps and extra fault tolerance, it is possible to get a high degree of assurance from a system built in Erlang or Elixir even with dynamic typing. And there are certainly many examples of that.

Re:Faithful Elm and the Amazing Router by nilkn on Thursday June 16, 2016 @11:56AM (#11916962)
Dialyzer is indeed nice, but as you say, it's completely optional, it's not Hindley-Milner, and it relies entirely on thorough, correct type annotations from the developer.

Elixir also follows the Ruby philosophy of hiding as much behind the syntax as possible, whereas Elm tends to be very explicit. So I stand by my point that Elixir is a very different language in practice from Elm.

Re:Faithful Elm and the Amazing Router by The_suffocated on Thursday June 16, 2016 @03:40PM (#11918353)
> Elixir also follows the Ruby philosophy of hiding as much behind the syntax as possible, whereas Elm tends to be very explicit.

This is not true. While Elixir may not make things as explicit as Elm (I don't know Elm well enough to assert or refute such a statement), the author of Elixir has stated in various occasions that Elixir prefers explicit to implicit.

For instance, in Elixir, unless one explicitly defines a String.Chars protocol for a data structure, string interpolation of that data structure will not compile. In contrast, pretty much everything can be implicitly interpolated in Ruby.

Another example is function calls. In Elixir, if f is not a named function but a variable bound to an anonymous function, you cannot call it by writing something like f(x). Instead, you must put a dot after f and write f.(x) to state clearly that you are calling an anonymous function.

Re:Faithful Elm and the Amazing Router by rdtsc on Thursday June 16, 2016 @01:38PM (#11917631)
I use Erlang and I like it a bit more than Elixir in general exactly because it is more explicit. It involves slightly more syntax but there is less hidden magic stuff happening behind the scene.
Re:Faithful Elm and the Amazing Router by kawera on Thursday June 16, 2016 @11:21AM (#11916727)
You are right about the type system but still, Elixir is a lighter, friendlier functional programming language compared to haskel or erlang. Not having previous FP experience, I'm having a good time learning Elixir + Elm.
Re:Faithful Elm and the Amazing Router by dllthomas on Thursday June 16, 2016 @12:05PM (#11917018)
Compilation targets for typed languages are very frequently untyped (think ASM, for the most canonical example) - it is neither weird nor difficult.
Re:Faithful Elm and the Amazing Router by nilkn on Thursday June 16, 2016 @12:16PM (#11917092)
Could you clarify? I don't immediately see the relevance of this. Why does it matter if the compilation target is or is not also strongly typed, and how does that imply anything about the experience of using a high-level dynamically typed language vs. a high-level statically typed language?
Re:Faithful Elm and the Amazing Router by dllthomas on Thursday June 16, 2016 @01:05PM (#11917389)
I understood the (some number of grands-)parent comment to be saying "Elixir seems a good candidate [for a compilation target]." If that was not your interpretation, then it is certainly non-sequiter. Re-reading, I think I misread something in a surrounding comment, though I'm not sure what.
Re:Faithful Elm and the Amazing Router by kawera on Thursday June 16, 2016 @01:14PM (#11917458)
I said "Elixir seems a good candidate" for backend development, not as a compilation target. The OP asked for suggestions regarding light, friendly FP languages for backend dev.
Re:Faithful Elm and the Amazing Router by dllthomas on Thursday June 16, 2016 @02:32PM (#11917980)
Yeah - like I said, I think I misread something up-thread, so I had the wrong context in mind.
Re:Faithful Elm and the Amazing Router by wyager on Thursday June 16, 2016 @02:26PM (#11917943)
Elm is essentially just Haskell with weaker type classes. If you can use Elm, I can't imagine why you'd have trouble using Haskell.