In the Haskell world effect systems are currently a big thing and one of the most popular libraries on that front is effectful
.
When it comes to libries for creating webservices, the most popular one at the time of writing this is probably servant
.
The two libraries go very well together but it isn't exactly obvious how you can marry them up since there doesn't seem to exist any examples at the moment. That's why I decided to create one. I'll go through setting up a simple service line by line and at the end of post I'll post the whole example. So if you're just after some quick boilerplate you can scroll right to the end.
If you haven't already, create a new project using cabal init -i
.
Then let's add some dependencies to our cabal file. You can probably get away with loosening most of the constraints but with those the example is guaranteed to work on ghc-9.2.7
.