How to write PureScript React to replace TypeScript React in 2021

Nice post! There’s just one part I have a minor objection to:

What is PureScript? It is a dialect of Haskell.

There are some slight differences. A lot of people, myself included, think that PureScript records are an improvement over Haskell records. But they are the same language. purs is now the second-most-popular Haskell compiler implementation, after ghc.

I personally would not describe PureScript as a dialect of Haskell, and neither would I describe purs as a Haskell compiler implementation, because (unlike PureScript) Haskell has an actual specification, and it’s quite easy to find examples where purs does not meet that specification. Laziness is probably the most obvious one, but there are also plenty of other differences in syntax, in the libraries which come with the compiler, and of course records, as you note.

It is sometimes possible to write programs which are accepted by both ghc and purs, but it’s rare, and it’s not something that I would recommend, as you’ll probably find that it quickly becomes awkward to express anything more complicated than f x y z = x + y * z in such a way that both compilers accept it; compatibility with Haskell code is a non-goal for us.

5 Likes