Is there an idiomatic Haskell?
I’ll share some things we kept in mind or adhered to in the last Haskell job I had.
First of all, the following are (almost) required reading for anyone starting serious Haskell projects:
- Parse, don’t validate: Parse, don’t validate
- Three-layer Haskell cake: Three Layer Haskell Cake
Keep in mind that these are obviously not rules set in stone, you should adapt to your situation.
When working with other (Haskell) programmers on the same project, having a set of guidelines makes everyone’s life easier. The point is not to please everyone, but to have the code be predictable for everyone.
- Use a style guide (e.g. we used Kowainik’s guide with our own tweaks)
- Decide on an automatic formatter (doesn’t matter which, just pick one. We used
fourmolu)- Maybe even enforce the format in your CI/CD (but do make sure everyone uses the same version in that case)
Not much else I can add; great thing about strong typing is that you can refactor “relatively” easily, so if you change your mind or the requirements change, refactoring isn’t such a set-back.
All in all, I wish you the best of luck in your endeavors, and when in doubt just ask fellow Haskellers more specific questions. Like, “which package should I use [in my current situation] to achieve [insert specific goal]?”
Discussion in the ATmosphere