Seeing these types of experiments are always interesting but just like CoffeeScript it requires learning two languages instead of one [so you an debug] which makes it a hard sale. Why not just write clean JavaScript? I know many want to make JavaScript the assembly language of the web but JavaScript is so much more complex than assembly I'm not sure that's necessarily a good goal to have.
Granted I would love for more languages to be usable on the web; even if I thought JavaScript was the best language it's always good to have competition and alternatives. But I think that has to come through browser support. I wonder how feasible it would be to generate some sort of byte code similar to how Java and others work with the JVM.
I wish a fraction of the effort going into "fixing" javascript went into fixing the real abomination: the DOM API (and CSS). Then everyone would benefit, even people using Dart, Coffeescript, and TypeScript.
With some languages, a big part of the selling point is that it's the same or similar to a language the programmer already uses. Clojure and ClojureScript come to mind, or even server-side JavaScript. Now, with ClojureScript, another common selling point is the synergy with react -- something that would appeal even to people not using Clojure (maybe because they're averse to the JVM).
So where is PureScript positioned related to this? Let's say I'm writing a backend in Ruby or Python and not Haskell, why PureScript instead of CoffeScript or sweet.js?
(I'm actually interested in this, not intended as a put-down.)
Is there any particular reason why PureScript was designed with a single number type (so no proper ints)? I know that's how JS sees things, but now with a whole proper type system it would seem like we should have proper numbers? I admit I haven't read the entire docs, is there a way to e.g. have the type checker ensure a number field such as a year in a date isn't assigned a non integer?
Why do I need statically typed languages to compile to Javascript? Isn't it just better to learn functional programming and dynamically typed languages?
Here's a gem to use PureScript files with Rails and the asset pipeline. It let's you add and compile PureScript files similar to how CoffeeScript files are added. https://github.com/romaimperator/purescript-rails
Saw two great talks about PureScript at Strange Loop last week, one by the language designer, Phil Freeman, and another by Bodil Stokke. Both the language and — almost equally importantly! — the accompanying book seem really well done to me.
If you want types like Java, TypeScript's probably a good choice. However, if you want the flexibility or the guarantees a powerful type system gives you, TypeScript's not going to cut it.
I've written quite a lot of TypeScript, and I generally feel very productive in it, but occasionally I feel like I want more from the type system (type classes, rank-N types, sum types, etc.) and tidier syntax. You might be interested in Bodil Stokke's recent Strange Loop talk, where she discusses why she switched from TypeScript. https://www.youtube.com/watch?v=yIlDBPiMb0o
I think you meant Purescript vs Elm. disclaimer: I have used neither.
Elm has its own package manager, not sure if that is good or bad!
The biggest difference is that Elm is almost incidentally a similar strongly typed functional programming language and its biggest focus has always been on FRP (functional reactive programming) to simplify UI programming in the browser.
From the project docs: "Generate simple readable Javascript" - isn't this more of a disadvantage than an advantage? the created Javascript code won't be high performance, which matters a lot in mobile today.
"Simple readable JavaScript" as opposed to the sort of output you might expect from compilers for other Haskell-like languages which attempt to preserve Haskell's semantics. Certainly there are cases where using techniques from pure functional programming can lead to poor performance (monadic recursion jumps to mind), but it is perfectly possible to write fast code using PureScript. And if you really need to squeeze out every last bit of performance, you can always write code in JavaScript and use the FFI.
Your minification process should be separate from your build process that's required to run it. This can generate JavaScript that's not a huge pain in the ass to debug, then you as the developer can minify it with existing libraries.
Though I'm not necessarily sure it wouldn't be high performance just maybe a hair slower to load. Then again I don't know how well their generator works.
I find JS a thoroughly unpleasant language to work with. When will we reach the point where JS could be abstracted away entirely? (Just like how I never need to interact with assembly language any more.)
1. JS as an assembly language. This is what emscripten[0], a LLVM bytecode-to-JS does, by following the asm.js specification[1]. This is for CPU-intensive tasks, not DOM manipulation. You can use any language that has a LLVM frontend.
2. JS as a target language, from a specific, new language. Those include cleaner variants that keep the same semantics (CoffeeScript, TypeScript, maybe Dart, ...) or more innovative ones, such as Elm[2], which is written in Haskell too. I'd say that a big innovation that makes the life easier is FRP (which is at the heart of Elm or React.js).
I fail yet to see what advantages PureScript brings compared to Elm.
Type correctness can help eliminate an entire class of bugs (type mismatch bugs) found in dynamically typed languages, or various gotchas with implicit typecasting.
[+] [-] BinaryIdiot|11 years ago|reply
Granted I would love for more languages to be usable on the web; even if I thought JavaScript was the best language it's always good to have competition and alternatives. But I think that has to come through browser support. I wonder how feasible it would be to generate some sort of byte code similar to how Java and others work with the JVM.
[+] [-] Tloewald|11 years ago|reply
[+] [-] paf31|11 years ago|reply
[+] [-] mariusmg|11 years ago|reply
[+] [-] mhd|11 years ago|reply
So where is PureScript positioned related to this? Let's say I'm writing a backend in Ruby or Python and not Haskell, why PureScript instead of CoffeScript or sweet.js?
(I'm actually interested in this, not intended as a put-down.)
[+] [-] alkonaut|11 years ago|reply
[+] [-] jp_rider|11 years ago|reply
[+] [-] toadkicker|11 years ago|reply
[+] [-] rtfeldman|11 years ago|reply
[+] [-] romaimperator|11 years ago|reply
[+] [-] tisue|11 years ago|reply
[+] [-] agumonkey|11 years ago|reply
[+] [-] giulianob|11 years ago|reply
[+] [-] moomin|11 years ago|reply
[+] [-] paf31|11 years ago|reply
[+] [-] mck-|11 years ago|reply
[+] [-] chowells|11 years ago|reply
[+] [-] noelwelsh|11 years ago|reply
(I.e. what are the relative strengths and weaknesses of these two "modern languages targeting JS" offerings?)
[+] [-] gregwebs|11 years ago|reply
Elm has its own package manager, not sure if that is good or bad!
The biggest difference is that Elm is almost incidentally a similar strongly typed functional programming language and its biggest focus has always been on FRP (functional reactive programming) to simplify UI programming in the browser.
[+] [-] boothead|11 years ago|reply
[+] [-] derengel|11 years ago|reply
[+] [-] paf31|11 years ago|reply
[+] [-] BinaryIdiot|11 years ago|reply
Though I'm not necessarily sure it wouldn't be high performance just maybe a hair slower to load. Then again I don't know how well their generator works.
[+] [-] billpg|11 years ago|reply
[+] [-] bru|11 years ago|reply
1. JS as an assembly language. This is what emscripten[0], a LLVM bytecode-to-JS does, by following the asm.js specification[1]. This is for CPU-intensive tasks, not DOM manipulation. You can use any language that has a LLVM frontend.
2. JS as a target language, from a specific, new language. Those include cleaner variants that keep the same semantics (CoffeeScript, TypeScript, maybe Dart, ...) or more innovative ones, such as Elm[2], which is written in Haskell too. I'd say that a big innovation that makes the life easier is FRP (which is at the heart of Elm or React.js).
I fail yet to see what advantages PureScript brings compared to Elm.
0: https://github.com/kripken/emscripten 1: http://asmjs.org 2: http://elm-lang.org/
[+] [-] rattray|11 years ago|reply
[+] [-] afsina|11 years ago|reply
[+] [-] dandare|11 years ago|reply
[+] [-] zak_mc_kracken|11 years ago|reply
https://leanpub.com/purescript/read
[+] [-] cmdrfred|11 years ago|reply
[+] [-] gamegoblin|11 years ago|reply
[+] [-] lemming|11 years ago|reply
[+] [-] paf31|11 years ago|reply
[+] [-] sassyalex|11 years ago|reply
[+] [-] andrewchambers|11 years ago|reply
[+] [-] NaNaN|11 years ago|reply
[+] [-] pjmlp|11 years ago|reply
[+] [-] lmm|11 years ago|reply
[+] [-] hawleyal|11 years ago|reply