Hi, currently my favourite tech stack for programming a web app is based on GHC and GHCJS, provided in the user-friendly all-inclusive framework Obsidiansystems Obelisk.
(Of course, Obsidian doesn’t only provide easy access to the GHC/GHCJS stack, but also includes reflex-platform for functional reactive programming and rightfully advertises itself as “batteries included”, it’s really that user-friendly)
One selling point of this stack is the seamless integration of backend and frontend. Types that are shared between the two are defined in a common
module and I thus have type-safety across the server-client-barrier.
Cherry on top: there is servant
to define my API (for communication between backend and frontend) and servant-reflex
to automagically generate the client-side web requests.
Now my question:
In principle this is possible to have with PureScript, too. I could either rely on node.js for JavaScript in the backend or - even better I guess - I would use purec to compile the backend.
How far is the PureScript ecosystem for this kind of stack?
I don’t insist on a functional-reactive framework like reflex. But what libraries are there ready to be used? Has someone put it all together somewhere already?
These are the libraries I use in Haskell:
- servant for an API (declaring the API on type-level is nice)
- servant-reflex for automatically generated web requests
- servant-server, snap, or some other server framework (I use servant-auth, too, but seems less essential)
- reflex-dom-core … I guess the best choice for a client-side framework is
halogen
, but maybe there are others - obelisk-route for routing that takes advantage of type-safety
(obelisk
does quite a lot of things, I hope I got all the essential stuff)
A PureScript version of the above stack has a chance of outperforming the GHC/GHCJS version, both in computational performance (and memory size, quite important for the client-side code) and in programmer productivity. I happen to like a lot of PureScript design choices a lot.
With obelisk
I am stuck at GHC 8.10.7 (which is fine, but not ideal) because of limitations in GHCJS. There is continuous progress on the GHC JavaScript backend that would replace GHCJS, but …
- I don’t know when this is production ready
- Haskell to JavaScript still suffers from additional complexity that PureScript avoids.
Thanks for any hints