4 ms·
Instead of comparing to Roy/Elm, which I have never heard of (has anyone?), he should compare it to livescript, a fork of coffeescript that has quite a few synt
by fuzzythinker 14y ago
Instead of comparing to Roy/Elm, which I have never heard of (has anyone?), he should compare it to livescript, a fork of coffeescript that has quite a few syntactic similarity to Haskell (it's inspired by it).
http://gkz.github.com/LiveScript/ http://gkz.github.com/LiveScript/
- tikhonj 14y agoI think this is targeted at Haskell people looking to compile to JavaScript rather than JavaScript people looking to use a new language. Roy and Elm are new languages that people who follow Haskell are probably familiar with. Comparing to them makes more sense than comparing to LiveScript if your audience is Haskell programmers. LiveScript is not really anything like Haskell at all except in some entirely superficial ways. Even the syntax isn't all that similar. Essentially, it's a slightly more functional CoffeeScript. While certainly interesting to the same people and for the same reasons as CoffeeScript, it's not very interesting to people who primarily use Haskell.
- jaekwon 14y agoCan you be more specific about how LiveScript is nothing like Haskell? Granted that LiveScript isn't Haskell, how are the syntactic features that are derived from Haskell not at all like Haskell?
- tikhonj 14y agoWhich parts of the syntax are like Haskell? As far as I can tell, the syntax for calling functions is similar to Haskell, but that's about it. Maybe some of the operators are vaguely like Haskell's, except they're baked into the language instead of being definable by the user. The vast majority of the syntax seems based on CoffeeScript.
- GeZe 14y agoLiveScript has many features over CoffeeScript that may not exactly be as in Haskell, but are inspired by it. You can define curried functions, use partially applied operators (addTwo = (+ 2)), use operators as functions (sum = fold1 (+)), use infix functions, ("hi" `startsWith` 'h'), compose functions (h = f . g), have proper list comprehensions, and its standard library, prelude.ls, is based off of Haskell's Prelude module (inclusion is optional though if you want to use underscore.js or something else). For more information check out http://gkz.github.com/LiveScript/blog/functional-programming-in-javascript-using-livescript-and-prelude-ls.html http://gkz.github.com/LiveScript/blog/functional-programming...
- spacemanaki 14y agoLiveScript is really only like Haskell in some syntax and naming of some functions. The defining characteristics of Haskell (to me, bear in mind I'm a Haskell noob) are strong, static, inferred types, and an emphasis on pure or near-pure functional programming (limiting side effects as much as possible). The defining characteristics are not a standard library function named "fold" or "takeWhile". LiveScript has JavaScript semantics, like CoffeeScript. These semantics differ from Haskell in deep and fundamental ways. Yes, it might also encourage functional programming, but so does Scheme and Clojure, both of which are really nothing like Haskell either. I don't think this is controversial.
- yoklov 14y agoIt's far enough away in terms of semantics that it's not particularly relavent. I'm haven't written much Haskell, but from what I can tell, Haskell is really all about the types. And the laziness. And the purity (which is all about the types). It's missing most of the the things that make Haskell Haskell, and not another functional language. It borrowed some syntax, but from what I can tell, it's much closer semantically to Scheme.
- chrisdone 14y agoSpot on summary. Fay and Elm are indeed both well known among Haskellers interested in language developments in the browser. LiveScript is a good comparison only in the way it transforms and is part of the wave of "compiling to JavaScript". For that reason it might be nice for me to mention it on the page.
- spacemanaki 14y agoI've heard of Roy, and even though I know very little about it or about LiveScript, comparing Haskell to Roy immediately makes more sense than comparing it to a language that "has a relatively straightforward mapping to JavaScript."