A simple template for Haskell projects built with Stack, together with some basic information to get into Haskell.
Some complementary language-independent information can be found here (one may have to dig among Java-specific stuff).
Note: version in the source code, the Cabal configuration, and the CI workflow (this should be automated).
The environment is made up of the GHC compiler and a dependency manager / build tool such as Cabal or Stack. Haskell libraries can be found on Hackage. Stack comes with sets of compatible libraries from Hackage organized in Long Term Support releases(LTS).
Versions we use (at the time of writing):
GHC | Cabal | Stack | LTS |
---|---|---|---|
9.2.5 | 3.6.2 | 2.9.1 | 20.5 |
Installing the environment is simplified using GHCup.
- install GHCup as presented here
- install GHC, Cabal and/or Stack using GHCup as presented here.
This project requires installing both Cabal and Stack.
A simple (and feature-rich) solution is to use the Haskell Language Server (HLS) which can be installed using GHCup as presented here, and have your IDE work with it.
For Visual Studio Code you can use the Haskell plugin, which is able to download HLS by need for you (indeed, it uses GHCUp for this).
But HLS works with many more IDEs.
- summoner, to setup Haskell projects (can avoid a lot of burden when starting a new project)
- hlint and stan, to analyse your code and/or propose refactoring
- specific preludes
- relude, lightweight standard library
- data structures
- containers, for assorted container types
- parsing:
- optparse-applicative, for parsing command-line options
- attoparsec, for writing more complex parsers
- file formats: