Backpack with Stack


At yesterday’s meeting of the Seattle Area Haskell Users’ Group, I talked briefly about my very recent experimentation with Haskell’s new module system, namely Backpack. I’ll briefly discuss what I’ve done so far right here.

The main thrust of my experimentation was to work through Edward Yang’s “Try Backpack” tutorial. For reasons that I gave up trying to figure out, I could not compile Edward’s examples, so I wrote my own from scratch. Here are the contents of the project and a brief description of each file:

foo.bkp: the Backpack file itself

This describes four units:

Makefile: the build definition

Since Stack does not yet support Backpack, I opted to use Stack just to manage the GHC compiler installation, and to describe the build of the project using a good old-fashioned Makefile.

To build the project:


stack.yaml: the Stack configuration file

This specifies which resolver and compiler version to use.

To install the correct version of GHC:

stack setup

The project also contains basic documentation about how to build on Windows, Linux and macOS.


I have a few questions about Backpack which I’ve not found any answers to yet:

Happy Backpacking!

Related posts

Haskell scripting
Setting up Haskell dev environment
Haskell Learners’ Group
Using doctest-discover with Stack revisited
Using doctest-discover with Stack



Content © 2024 Richard Cook. All rights reserved.