Configuration
Managing software¶
To change your version of GHC, cabal, or the Haskell Language Server:
You should see something like:
This makes it easy to change version of the compiler, the Haskell language server, and cabal (the package manager).
Stack
stack
is (roughly) an alternative package manager. Either cabal
or stack
work well, but this documentation defaults to cabal
.
Installing packages¶
To add packages, include their names to the package list in your .cabal
file:
library
exposed-modules: MyLib
build-depends:
base ^>=4.16.3.0,
text,
NEW PACKAGE,
ANOTHER NEW PACKAGE
hs-source-dirs: src
default-language: GHC2021
Packages are hosted here, but you can find out more about what packages to use for what here.
Extensions¶
Haskell allows new code features to be enabled/disabled with lines like:
at the top of files.
We recommend setting the default-language to GHC2021
, which enables a set of compatible and standard extensions.
Warning
GHC2021
will only work for GHC 9 and greater. Otherwise replace with Haskell2010
.
library
exposed-modules: MyLib
build-depends:
base ^>=4.16.3.0,
text,
hs-source-dirs: src
default-language: GHC2021