Container image for Haskell on Codewars: GHC 9.14.1 with Cabal 3.16.1.0, for Linux amd64 and arm64.
The GHC 9.2.5 image is still available from the 9.2.5 tag.
Kata code can import the packages listed in rootfs/opt/haskell/challenge.cabal and their dependencies.
Every version is pinned by rootfs/opt/haskell/cabal.project.freeze.
| package | version |
|---|---|
| base | 4.22.0.0 |
| attoparsec | 0.14.4 |
| fakedata | 1.0.5 |
| haskell-src-exts | 1.24.0 |
| heaps | 0.4.1 |
| hspec | 2.11.18 |
| hspec-attoparsec | 0.1.0.2 |
| hspec-codewars | 0.1.0 |
| hspec-contrib | 0.5.2 |
| hspec-formatters-codewars | 0.3.0 |
| hspec-megaparsec | 2.2.1 |
| HUnit-approx | 1.1.1.1 |
| infinite-list | 0.1.3 |
| lens | 5.3.6 |
| megaparsec | 9.8.3 |
| mtl | 2.3.1 |
| parsec | 3.1.18.0 |
| persistent | 2.18.1.0 |
| persistent-sqlite | 2.13.3.1 |
| persistent-template | 2.12.0.0 |
| primes | 0.2.1.0 |
| random | 1.3.1 |
| regex-pcre | 0.95.0.1 |
| regex-posix | 0.96.0.2 |
| regex-tdfa | 1.3.2.7 |
| split | 0.2.5.1 |
| text | 2.1.3 |
| transformers | 0.6.1.2 |
| vector | 0.13.2.0 |
The packages are built once into a GHC environment file (GHC_ENVIRONMENT=/opt/haskell/environment), so ghc and runghc use them without Stack or Cabal at run time.
Code is compiled with -XGHC2021. The test command is:
ghc -XGHC2021 -O -j2 +RTS -A128m -n2m -RTS --make -v0 -outputdir /tmp -isrc:test test/Main.hs -o tests && ./testsThe solution goes in src/, and the test module (its name must end with Spec) goes in test/.
test/Main.hs and test/Spec.hs are provided by the image and use hspec-formatters-codewars.
Code without tests runs with runghc -XGHC2021 Main.hs.
bin/run passingThis copies examples/passing into a container and runs the test command above. Set IMAGE to test a different image.
docker build -t ghcr.io/codewars/haskell:latest .The build runs rootfs/opt/haskell/smoke/run.sh, which compiles and runs a test that uses each package.