3 ms·
The difference between Reason's and PureScript's output is easily explained if you take into account the differing goals of the two projects. PureScript has an
by djur 9y ago
The difference between Reason's and PureScript's output is easily explained if you take into account the differing goals of the two projects. PureScript has an emphasis on [JS interop](https://leanpub.com/purescript/read#leanpub-auto-polyglot-web-programming https://leanpub.com/purescript/read#leanpub-auto-polyglot-we...) going both ways. Being able to add some PureScript code to a JS codebase, or even to intentionally layer a JS frontend on top of a PureScript core, is an explicit design goal.
You can actually create instances of PureScript types in JS and pass them into functions defined in PureScript. That explains why there's a JS class for each data constructor. Similarly, the generated PureScript code can't actually "know[] the match is exhaustive", since it could be called from anywhere.
The article was interesting, but I think the comparison would benefit from providing an example of the code generated for calling the function as well as its definition.