Skip to content

Instantly share code, notes, and snippets.

View dxtr's full-sized avatar

dxtr

  • Paf
  • Sweden
View GitHub Profile
@ollimandoliini
ollimandoliini / effectful-servant.md
Created August 17, 2023 11:02
effectful ♥️ servant

effectful ♥️ servant

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.

@mstksg
mstksg / haskell.yml
Last active September 30, 2021 08:16
Stack Project Github Action Template
# Haskell stack project Github Actions template
# https://gist.github.com/mstksg/11f753d891cee5980326a8ea8c865233
#
# To use, mainly change the list in 'plans' and modify 'include' for
# any OS package manager deps.
#
# Currently not working for cabal-install >= 3
#
# Based on https://raw.githubusercontent.com/commercialhaskell/stack/stable/doc/travis-complex.yml
#