Skip to content

sinogermany/haskell-tutorial

Repository files navigation

Build Status License: MIT

Haskell Tutorial

This repo consists of exercises to learn Haskell and Functional Programming.

Currently it consists of exercises from Haskell CIS194.

Project Structure

The project structure follows the normal convention:

  • src contains the implementation of the exercises. E.g. the CIS194.Homework01.Exercise01 module.
  • test contains Tasty.HSpec specs of the exported functions from the modules in src.
  • test/Spec.hs is the test auto-discovery driver.
  • scripts contains useful shell scripts to be run in CI pipelines, docker containers and local environments.

Code Style

Dev and test dependencies

To run the tests in the project, we need:

  • Binary dependencies: stylish-haskell, hlint, tasty-discover, hpc-threshold and stack-hpc-coveralls (CI only).
  • Library dependencies: see dependencies specified in package.yaml.

Running the tests (in the local environment)

  • To install the binary dependencies, run stack install stylish-haskell hlint tasty-discover hpc-threshold.
  • To install the library dependencies, run stack build --test --only-dependencies.
  • Run ./scripts/docker/style-check-and-unit-test.sh.

Running the tests (in a docker container)

  • Before building the docker image, DO NOT FORGET to increase the docker daemon RAM to 8GB or more.
  • To build the docker image, run docker-compose build haskell.
  • Run the style check and test docker-compose run --rm haskell ./scripts/docker/style-check-and-unit-test.sh.
  • Test coverage report will be included in the console output.

Useful Links