4 ms·
I started writing a small-to-medium-sized web application in Elm, because I wanted to try out FRP. I mentioned my experiences here: https://news.ycombinator.com
by ekidd 11y ago
I started writing a small-to-medium-sized web application in Elm, because I wanted to try out FRP. I mentioned my experiences here: https://news.ycombinator.com/item?id=10726648 https://news.ycombinator.com/item?id=10726648 In short, Elm has some nice error messages, and it's easy to use at first. But as my app got larger, other factors became major issues:
- Elm requires a painful amount of boilerplate code. A lot of this is related to the fact that it tries to do functional programming without many of the customary abstractions.
- Elm's FFI (via the ports system) is really painful to use. If you ever need to integrate to third party code, or get a value from the DOM, it's going to require creating a new port in your main module, a new listener in JS, and wiring everything up.
- A lot of Elm tools and APIs have bugs. For example, I discovered that if I built my app using the recommended Elm architecture, I couldn't use the debugger. But even some core APIs like Window.dimensions burned me more than once, with things like: https://github.com/evancz/start-app/pull/37 https://github.com/evancz/start-app/pull/37
I've started porting the app to Purescript. I used the Purescript book, which is excellent: https://leanpub.com/purescript/read https://leanpub.com/purescript/read I'm especially happily with Purescript's FFI, and its generally pragmatic attitude.
However, Purescript doesn't come with a "blessed" UI library, so you have to pick. I briefly tried the ambitious Halogen library, but the sheer type-system complexity ground me down quickly. I eventually went with the Thermite library, which is a very thin library wrapper of React (< 300 lines of code). So far, Thermite has been very nice, and quite easy to use, though it could use some enhancements and tweaks.
Overall, I like Purescript a lot. My basic problem with Elm is that it tries to be very opinionated, with very few escape hatches, so when I got stuck, I tended to get stuck very hard. Whereas with Purescript, it's much easier to drop down to JavaScript, but also to "pop up" and pull a well-known abstraction out of the standard Haskell toolbox if I need one.