Skip to content

💻 Exercises for the Haskell Beginners 2022 course

License

Notifications You must be signed in to change notification settings

trylinka/exercises

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

exercises

GitHub CI Hackage MPL-2.0 license

Exercises for the Haskell Beginners 2022 course. The course itself can be found here:

This repository contains a complete Haskell project. The project comprises four Haskell files (modules) in the src/ directory. Each module provides exercises for an individual lecture and has the corresponding name (e.g. Lecture1.hs).

Deadlines

These exercises were created specifically for the Haskell Beginners 2022 course. You can expect to get feedback on your solutions in you meet the following deadlines:

  • Lecture1.hs: Jan 17, 2022, 23:59:59 GMT
  • Lecture2.hs: Jan 24, 2022, 23:59:59 GMT
  • Lecture3.hs: Jan 31, 2022, 23:59:59 GMT
  • Lecture4.hs: Feb 7, 2022, 23:59:59 GMT

Working with the course

This section contains instructions about setting up the development environment and preparing the exercises repository.

First time

  1. Fork the exercises repository.

  2. Enable GitHub Actions for your forked repository.

    • Visit: https://github.com/<YOUR_GITHUB_USERNAME>/exercises/actions
  3. Clone your forked repository.

  4. Enter the exercises directory and add the original repository as a course remote.

    git remote add course https://github.com/haskell-beginners-2022/exercises

    You can verify that everything is done correctly by running the git remote -v command. The output of this command will looks similar to the below:

    course https://github.com/haskell-beginners-2022/exercises (fetch)
    course https://github.com/haskell-beginners-2022/exercises (push)
    origin [email protected]:chshersh/exercises.git (fetch)
    origin [email protected]:chshersh/exercises.git (push)

Asking for feedback

When you finished implementing exercises for a particular lecture, create a Pull Request to your fork. The repository already contains PR template with the prefilled text and mentions all current mentors of the course.

ℹ️NOTE: Open Pull Request to your fork and not this repository. We can't merge solutions to this repo. But if you open PRs to your repository, you can eventually merge all the solutions and enjoy gree all-passing CI 🍏

To open a PR to your fork, you need to change base repository to your own repository, as shown on the screenshot below:

PR to fork example

After you change, the PR view will change accordingly:

Final PR to fork

Updating your fork

The course content (exercises, tests, configuration, etc.) might change after you forked the course. To get the latest updates, follow the below instructions:

  1. Switch to your main branch locally and make sure it's in sync with the latest version of your fork on GitHub.

    git checkout main
    git pull --rebase --prune
  2. Fetch all the course changes and save them locally.

    git fetch course main
    git rebase course/main

    NOTE: This stage may require you to resolve conflicts.

  3. Push local changes to your own fork.

    git push origin main --force

Installing Haskell

Follow the below instructions to configure the Haskell development environment.

Haskell Toolchain

To develop in Haskell, you need to install ghcup, ghc and cabal.

  1. Install ghcup and follow ghcup instructions for successful installation (remember to restart your terminal afterwards to avoid an unknown ghcup command error on the next step).

  2. Install the recommended version of the Haskell compiler — GHC — and the Cabal build tool. After you install ghcup, it is easy to install the rest with a few commands from your terminal, if these tools are not yet installed.

    ghcup install ghc 8.10.7
    ghcup set ghc 8.10.7
    ghcup install cabal 3.6.2.0

    You can verify that everything is installed correctly by running the following commands:

    $ ghc --version
    The Glorious Glasgow Haskell Compilation System, version 8.10.7
    $ cabal --version
    cabal-install version 3.6.2.0
    compiled using version 3.6.2.0 of the Cabal library
  3. Run cabal update to fetch the latest info about Haskell packages.

Haskell IDE

If you don't have any IDE preferences, we recommend installing Visual Studio Code with the Haskell plugin. The mentioned plugin would give you everything required to immediately start coding with Haskell.

How to build and test?

To compile the entire project, run the following command from your terminal:

make build

To run tests for a specific lecture only (e.g. the first one), use the following command:

make test-lecture1

You can also run tests only for a single function. For example, to run tests for the strSum function, execute the following command:

cabal run exercises-test --enable-tests -- -m "strSum"

Acknowledgement

This course is inspired by Learn4Haskell authored by @vrom911 and @chshersh.

About

💻 Exercises for the Haskell Beginners 2022 course

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Haskell 97.9%
  • Makefile 2.1%