top | item 5787653

Elm at Prezi

175 points| enum | 13 years ago |engineering.prezi.com | reply

100 comments

order
[+] Ixiaus|13 years ago|reply
For those interested in compiling down to Javascript with a strongly and statically typed language, there's a brilliant proper subset of Haskell that compiles down to Javascript called "Fay": https://github.com/faylang/fay/wiki
[+] rtfeldman|13 years ago|reply
Also Roy, which is statically typed (with type inference) and is designed for JS interop. It's also written in JS and can be installed with just npm install roy http://roy.brianmckenna.org/
[+] jallmann|13 years ago|reply
There is also js_of_ocaml, which can be used to compile straight OCaml to Javascript:

http://ocsigen.org/js_of_ocaml/

The site has some cool demos including webgl, canvas, and a OCaml toplevel (REPL).

[+] revelation|13 years ago|reply
[..] and every line of JavaScript code costs too much time to maintain.

At this point, go to the next blackboard. Write after me:

You can not debug Elm. There is no debugger. You can not debug Elm. There is no debugger.

[+] icarus127|13 years ago|reply
I haven't written any Elm but having written some Haskell I can say it's surprising how often you _don't_ need a debugger in a functional language. I doubt Elm not having a debugger is as difficult as, for instance, Javascript or Coffeescript not having a debugger would be.
[+] PuercoPop|13 years ago|reply
Paraphrasing a great programmer: "The best debugger is your brain". I have no issue with people using a debugger, but it is not a must in order to debug, imho.
[+] triplepoint217|13 years ago|reply
The bigger problem I encountered trying it out yesterday was that it (at the moment) is fairly happy to generate an empty page and not give any compiler errors.

I assume that will change, but it made it pretty hard for me to get started with the language.

That said, I hope it changes, because Elm looks really neat!

[+] halacsy|13 years ago|reply
is there any theoretical limitation?
[+] egeozcan|13 years ago|reply
> The cost of writing JavaScript is just too high

Every time I see such strongly worded statements, I get amazed by how the authors got to analyze the skills of every developer in the world.

[+] subb|13 years ago|reply
Usually, to calm myself, I reword it like this :

For us/In my opinion, the cost of writing Javascript is just too high.

See? Now the rage is gone! I think I'm going to sell this trick...

[+] snprbob86|13 years ago|reply
This is not a statement about the skills of other developers. This is a statement about the applicability of JavaScript to the sorts of problems people are trying to solve with it. There are a lot of nice things about JavaScript that people didn't quite understand or appreciate in the early days, but that doesn't change the fact that the HTML5 stack is deeply flawed in many ways for the needs of application developers. That shouldn't be surprising or controversial: All of these technologies were developed in a simpler time for a simpler set of problems.... and in a rush.
[+] gonehome|13 years ago|reply
Here's a list of languages that compile down to Javascript: https://github.com/jashkenas/coffee-script/wiki/List-of-lang....

I didn't realize how many there were.

[+] SCdF|13 years ago|reply
It's fairly crazy, but then again there are ~700 programming languages listed on Wikipedia, so really, there are just a lot of programming languages in general.

In terms of Foo->JS there seem to be two main camps, at least that I've noticed: writing a "better" JS (CoffeeScript / Dart et al), and writing something that converts your language to JS so you don't have to learn JS (ClojureScript, Scala.js etc) at all.

The latter can have ~700 of those before you've even started to duplicate yourself, so there is still a ways to go :P

Arguably there are only half a dozen or so "real" contenders in the former category (in the same way when you decide you want to learn a new programming language you don't pick from all ~700).

[+] zem|13 years ago|reply
i started a subreddit for people interested in compile-to-js: http://www.reddit.com/r/altjs/

not gained much traction so far, but it's a useful place to post interesting links as i find them.

[+] epidemian|13 years ago|reply
Great news that Evan can dedicate fully to Elm as his main job. I'm very curious about the language and its departure/simplification over traditional DOM manipulation with JS. I hope the best for the project and would love to see some effort for the compiler targeting asm.js :D
[+] aristidb|13 years ago|reply
It seems like Haskell users are quite intent on not using Javascript... Elm is written in Haskell. So is Fay. And of course ghcjs.
[+] weego|13 years ago|reply
The world seems to be intent on writing mountains of code to avoid writing javascript, and usually ending up with a system that compiles to more javascript than if they just wrote javascript. Saying javascript is broken is a nonsense, they mean they feel they should be above writing javascript due to its quirks and inconsistencies. Whatever they write the end result is still the "broken" language they wanted to avoid. It all seems like a huge waste of resources and smart people's time to me, but then I've been writing javascript for getting on for 15 years so perhaps im past it and don't "get it" anymore.
[+] IanChiles|13 years ago|reply
I think that may not be the case - it may be more that Haskell is a fabulous language to write compilers and parsers in, and so lots of compilers and parsers are written in it :)
[+] halacsy|13 years ago|reply
because JS is flexible, the VMs are really good recently and the web platform is tempting but haskell coders miss safety, succinct syntax and efficiency.
[+] efnx|13 years ago|reply
Yes - I think once you start being productive with Haskell you prefer to work in languages with strong type systems that are purely functional (Haskell and subsets of it). When I work in Haskell it feels like a burden has been lifted from my shoulders - for real! Coming back to JS is simply painful.

I think more programmers would experience this if it weren't for Haskell's insane learning curve. It took me a ~year of casual learning and skimming before I could do anything useful. Very casual, though ;)

[+] fabokzs|13 years ago|reply
I'm wondering if we need a different testing approach for these new wave "functional programming languages".
[+] jessedhillon|13 years ago|reply
I find function application without parentheses enclosing the parameter list to be highly unreadable. Is there something wrong with me?
[+] epidemian|13 years ago|reply
I think i also got confused the first time i saw that syntax (being used to C-like languages hehe). It started making lots of sense once i got familiar with the concept of currying and functions as first-class values.

Suppose you have a function f with type Int -> Int -> Int (you can read it as "it takes two integers and returns an integer" or "it takes one integer and returns a function that takes an integer and returns an integer"), then:

    f
is the function itself, and it is a usable value.

    f 42
is a function of type Int -> Int, and a perfectly valid value too. And

    f 42 33
is just and Int.

It's like with each application you take one arrow from the function type; until you get something that's not a function any more :)

[+] tikhonj|13 years ago|reply
It's just new and you're not used to it. There's nothing wrong with finding new and different syntax confusing, as long as you're willing to keep an open mind.

If you use it for a while, you'll get used to it. After a while, I've found it makes the most sense. I think it's better because it reduces the amount of syntactic noise in the code.

It's a simple design decision. Function application is the most important part of the language. So it gets the best syntax: none.

[+] sixbrx|13 years ago|reply
A lot of modern mathematics also drops the parens, especially in areas related to modern algebra. It really makes the most sense and is less ambiguous, with parens not being overloaded between grouping and application.
[+] efnx|13 years ago|reply
It does take getting used to. Also, seeing $ everywhere on a line and . not being property access. Though with lenses...I won't get into that...
[+] d0m|13 years ago|reply
Lol, nothing wrong with you. Just not used to it.
[+] Dewie|13 years ago|reply
I've preferred f x y over f(x,y) ever since I first saw it used in Haskell. Maybe it's just a matter of preference.
[+] egonschiele|13 years ago|reply
I am so excited! It's nice to see a functional language like Elm getting financial support from a company.
[+] tingletech|13 years ago|reply
not to be confused with the elm, the old unix mail client:

http://www.instinct.org/elm/

[+] obviouslygreen|13 years ago|reply
I knew this was unlikely to be the subject of the article but clicked through anyway... oh well.
[+] 205guy|13 years ago|reply
I'm not the only one. Hey, you can still run pine if you want.
[+] jlatt|13 years ago|reply
I was really impressed by elm, but I strongly prefer working with a library that provides some of the features without transpiling. If anyone else is interested, I'm looking for some help with my project: https://github.com/jlatt/frp.js
[+] Nekorosu|13 years ago|reply
Elm is the future and I'm glad to see it now has some good company's support.
[+] cuttooth|13 years ago|reply
Elm is the future as much as Java is dead in the software development industry.
[+] saosebastiao|13 years ago|reply
Awesome...you have me intrigued. I would worship the ground you walk on if you targeted asm.js.
[+] boothead|13 years ago|reply
Slightly off topic but does anyone know of ans FRP library for python?
[+] nahname|13 years ago|reply
Inversion of control is a good thing. Why would you want to avoid it?
[+] laszlok|13 years ago|reply
I think the idea here is that you aren't /forced/ into inversion of control. That is, if it is clearer to write things side by side, instead of separated into another callback function, you can keep them together.
[+] icarus127|13 years ago|reply
I'm genuinely curious, why do you think inversion of control is an unqualified Good Thing™?
[+] zeckalpha|13 years ago|reply
It's not avoided, it just has a different syntax. (Monadic rather than callbacks, but since they are the same thing...)
[+] jluan|13 years ago|reply
Congratulations, Evan!
[+] wheatBread|13 years ago|reply
Ahhhh, I recognize that user name! Thank you!! :D