Sharing Haskell Builds Across a Team

March 26, 2016

Tony DiPasquale talks about collaborating on Haskell projects across a distributed team of people with very different computers. Learn he uses Docker and Stack at ThoughtBot to minimize his coworkers’ build times and ease deployment.


  • There are about ten people at ThoughtBot who are into Haskell
  • They started with it about two years ago
  • Their biggest problem starting out was getting a consistent environment across everyone’s computer
  • How to share code and deps? At the time compile times were too long to deploy apps to Heroku
    • First tried Halcyon
    • Tony started experimenting with Docker to standardize builds and share dependencies (avoiding long GHC rebuilds)
    • They made a series of increasingly filled-out containers, such as Ubuntu, Ubuntu + GHC, Ubuntu + GHC + Yesod, etc
  • Example Dockerfile
  • Scripts to automate pushing images to Docker Hub
    • Every time you update Haskell deps you have to run the script
    • Kind of manual but it keeps all your coworkers up to date
  • They then use docker-compose to run the images with the right settings
  • This was all good, BUT… It could be better, with Stack
    • How to merge Stack and Docker?
    • One option is Stack’s own Docker integration
    • Enabled by saying “docker: true” in your stack.yml
    • With this you don’t have to worry about your team knowing how to use Docker
    • Beware the pitfalls: it does not use docker-compose
    • The heroku build tools to deploy the code don’t work with Stack
  • So Thoughtbot doesn’t use Stack’s built-in Docker integration
    • They manage the Docker images with Stack inside
    • Example project: carnival
    • The heroku toolbelt can then deploy a docker image
    • (Note that Stack can do sandboxing and reusing builds itself too)
    • Stack could do better integrating with docker-compose rather than just Docker