Haskell vs Purescript

I know this question has been answered to lot of places and I have read few of them. Recently I asked a question Is Haste compiler dead? - Links - Haskell Community, some people mention it better than Haskell. I want to know exactly how it is better. Because I came to know that GHCJs will get merge in the future. If it does then, how comparable will be with Purescript.

(I have asked this same question in both Haskell and Purescript discourse)

2 Likes

I guess I might have been one of the folks.

I did not want to say that PureScript overall is better than Haskell but records in PureScript are a lot “better” - meaning the record system is crafted into PureScript from the start, there are no issues with label-scoping, etc.

For me PureScript right now basically provides everything I usually work with in Haskell (type classes, fun-deps, …).
Yes GADTs and maybe type-families would be nice but to be honest for writing front-end it did not actually end up in a situation where this would really have improved my experience (IMHO this is different for library authors and probably for more complex domains)

As of how it’ll turn out if GHCJs will be merged in? I have no clue - for me this will very much depend on how the generated code will turn out.
Right now GHCJs is really impressive but the generated code is not (should say was not when I last checked - it was really big and I don’t really need or maybe don’t want laziness and async-execptions when working inside the browser).

Personally I think/hope I’ll stick with PureScript for a long time - it’s right in the golden middle between Haskell and Elm for me.

6 Likes

PureScript has @garyb which is a pretty big pro

8 Likes

PureScript certainly has plenty of differences from Haskell, but many of them are a matter of opinion and there isn’t a single “better” language. Any discussion of the differences should start with the docs on the matter, but I think there are some “philosophical” differences that aren’t mentioned there. I would say other differences include:

  1. Despite having as little as possible implemented in the core language and pushing everything else out to the library ecosystem, there seems to be just a single canonical way to do most fundamental things. There aren’t a bunch of different ways to raise/handle errors or deal with strings. (Though there are certainly many ways to do “higher-level” things, like there’s a lot of different UI frameworks.) There aren’t really any alternative preludes. Probably because
  2. PureScript tried to learn a lot from Haskell’s “mistakes” so the single standard prelude and common libraries look a lot more like what you’d see in one of the alternative preludes in Haskell. e.g., ideally, you will never run into a partial function in PureScript unless it’s represented with the Partial class.
  3. PureScript has a much smaller package library. You won’t get far without having to dip into the FFI (meanwhile npm/node.js has pretty much any package imaginable).
  4. It seems to me like you have to try a lot harder to shoot yourself in the foot in PureScript. The way I said it makes it sound like PureScript is objectively better, but sometimes doing something unsafe that you somehow know is just going to work takes a lot more effort in PureScript (Like writing an algorithm using arrays and indexing where you know that the indexes are all correct).
  5. PureScript isn’t as feature-rich, which is maybe just a restatement of PureScript doesn’t have language extensions.
6 Likes