Hacker News new | past | comments | ask | show | jobs | submit login

I'm going to go out on a limb and suggest this stack (especially if you're into functional programming):

Haskell + Elm or PureScript + Postgres

The best part about it is that it helps you catch many errors at compile time, instead of having your app crash at run time.

For keeping your Haskell and Elm data types in sync while maintaining sanity, I recommend elm-export [0], which will automatically generate the Elm types and JSON decoders from your Haskell code, using GHC Generics. Watch the author talk about it [1].

Choosing Elm over JS already gives you a head start, but you might hit a productivity wall at some point, and PureScript gives you all that extra power with its advanced type system. Some related discussion here [2].

Check out Matt Parsons' blog [3] for more on Haskell, Elm and PureScript.

Lastly, for database you can use Persistent [4] which gives you a type-safe API for data modelling and data store, and can automatically generate and perform migrations for you.

[0]: https://github.com/krisajenkins/elm-export

[1]: https://www.youtube.com/watch?v=sh4H8yzXnvw

[2]: https://www.reddit.com/r/haskell/comments/569cax/

[3]: http://www.parsonsmatt.org/

[4]: https://hackage.haskell.org/package/persistent

P.S. Do take my suggestions with a grain of salt as I don't have much experience with any of the fancy JS frameworks.




Thanks for the recommendations. I need to study both Elm (never used it) and PureScript (have just played with it). I am almost ready to publish my first Haskell book (my take on getting started the easy way, with a tutorial for a subset of the language and some cookbook style coding recipes to play with). I am thinking of doing a volume II cookbook that covers web development, and other topics. I use scotty and yesod, and experimenting with Elm and PureScript sounds good.


Looking forward to your book! A volume II sounds like a good idea too.

So far I've only used Yesod myself, but Spock looks very promising and I've heard great things about Servant for writing APIs.


Servant looks great. I have only spent a few hours playing with it, but from what I have seen, I like it.


Servant is still _very_ rough around the edges, imo. I like it a lot for mocking APIs [0], but I'd be wary about using it in production for anything other than a small service.

Right now I'm keeping an eye on servant-auth [1] and the GHCJS implementation of servant-client [2], as they're both extremely compelling.

[0] Recently, I needed to test something against a work-in-progress API. I wrote out a rough type-level specification and had servant-quickcheck generate arbitrary data. When I needed to test more concrete data, it was trivial to incrementally move endpoints over to concretely defined stubs.

[1] https://github.com/plow-technologies/servant-auth

[2] https://github.com/LumiGuide/servant/tree/client-ghcjs




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: