Lessons learned while writing a Haskell application

Click for: original source

Gabriel Volpe in this article writes about his experience with Haskell. He introduced Haskell at his last job and wanted to put into practice all the stuff he learned: take the good, leave the bad.

Note: if you write Scala, many of the tips will also be useful for you.

The article covers:

  • Configuration
  • Production-ready effect: RIO (influenced by Michael Snoyman’s articles The ReaderT design pattern and The RIO Monad)
  • Polymorphic record of functions
  • Smart constructors
  • Parametric reasoning
  • Web server

… Web server is written using servant and it’s a pleasure to use. It also allows you to generate documentation from the API definition using swagger. Servant is a set of Haskell libraries for writing type-safe web applications but also deriving clients (in Haskell and other languages) or generating documentation for them, and more.

Parametric reasoning matters: ideally we should be able to tell what a function does by just looking at its type signature. Great read for anybody into functional programming or web development!

[Read More]

Tags programming software functional-programming akka scala