Lesson 35. Building projects with stack

 

After reading lesson 35, you’ll be able to

  • Work with Haskell’s stack build tool
  • Build stack projects
  • Configure key files generated by stack

When moving beyond learning a programming language to using it for more serious projects, one of the most important things to have is proper build automation. One universal option is to use a tool such as GNU Make. But many languages have their own build tools. Java has several industrial-strength options such as Ant and Maven, Scala has sbt, and Ruby has rake. Given Haskell’s academic history, it might come as a surprise that Haskell too has a powerful build tool: stack. The stack build tool is a relatively recent addition to the Haskell ecosystem, but it has had a tremendous impact. stack automates and manages several parts of Haskell projects:

  • Provides an isolated installation of GHC per project to ensure that you’re always using the correct version
  • Handles the installation of packages and their dependencies
  • Automates the building of the project
  • Aids you in organizing and running tests on your project

35.1. Starting a new stack project

35.2. Understanding the project structure

35.3. Writing your code

35.4. Building and running your project!

Summary