This repository contains the programming assignments (MPs) for CS421. Throughout the course, you'll complete Haskell assignments that explore functional programming concepts and implement programming language features.
First, create your own copy of this repository by forking it on GitHub:
- Click the Fork button in the top-right corner of this repository
- This creates a copy under your GitHub account where you can commit your work
Clone your forked repository to your local machine:
git clone https://github.com/YOUR-USERNAME/cs421-release.git
cd cs421-releaseYou may want to rename this directory. We'll assume for these docs that you keep the name as-is.
To receive new assignments and updates from the course repository, add it as an upstream remote:
git remote add upstream https://github.com/mattoxb/cs421-release.gitVerify your remotes:
git remote -v
# Should show:
# origin https://github.com/YOUR-USERNAME/cs421-release.git (fetch)
# origin https://github.com/YOUR-USERNAME/cs421-release.git (push)
# upstream https://github.com/mattoxb/cs421-release.git (fetch)
# upstream https://github.com/mattoxb/cs421-release.git (push)You have three options for setting up your Haskell development environment:
Option 1: VSCode + Docker (Recommended)
This is the easiest way to get started without installing Haskell tools locally:
- Install Docker Desktop
- Install VS Code
- Install the Dev Containers extension
- Open this repository in VS Code
- When prompted, click "Reopen in Container" (or press
Ctrl+Shift+Pand select "Dev Containers: Reopen in Container")
See STUDENT_SETUP.md for detailed instructions and troubleshooting.
Option 2: Docker Only
If you prefer working in a terminal without VS Code:
docker pull mattox/cs421-haskell-dev:latest
docker run -it -v "$(pwd):/home/student/workspace" mattox/cs421-haskell-dev:latestOption 3: Nix Package Manager
If you use Nix, the included flake.nix provides all necessary dependencies:
nix developWhen new assignments (mp2, mp3, etc.) are released, pull them from the upstream remote:
# Fetch updates from the course repository
git fetch upstream
# Merge updates into your local branch
git merge upstream/main # or upstream/master, depending on branch nameIf you've modified starter code, you may encounter merge conflicts. Resolve them carefully to preserve both your work and the new assignment files.
Each assignment is in its own directory:
mp1a-recursion/- Part 1: Recursion and higher-order functionsmp1b-adts/- Part 2: Algebraic data types- More assignments will be added throughout the semester
Start the Haskell REPL (inside the Docker container or after setting up Haskell locally):
cd mp1a-recursion # or whichever assignment directory
stack ghciRun the test suite for an assignment:
cd mp1a-recursion # or whichever assignment directory
stack testSee individual assignment README files for detailed instructions and problem descriptions.
Commit your work regularly to your forked repository:
git add .
git commit -m "Complete mytake and mydrop functions"
git push origin main # Push to YOUR fork, not upstreamNote: You cannot (and should not) push to the upstream remote. That's the course repository maintained by the instructor.
Git is not used for submission. It may be super helpful during office hours though. Actual submission happens via prairielearn.
- Check the individual assignment READMEs for problem-specific guidance
- See STUDENT_SETUP.md for environment setup help
- Ask on the class Discord or attend office hours
- If you're stuck on a problem, you can define it as
undefinedto keep your code compiling:myFunction :: [a] -> [a] myFunction = undefined
- Code that doesn't compile receives a zero. Always ensure your code compiles, even if you need to use
undefinedfor incomplete functions. - Push to
origin(your fork), notupstream- The upstream remote is read-only for students - Commit regularly - Don't lose your work!
- Keep your fork private. This is required by course policy to prevent academic integrity issues
# One-time setup
git clone https://github.com/YOUR-USERNAME/cs421-release.git
cd cs421-haskell
git remote add upstream https://github.com/mattoxb/cs421-release.git
# When new assignments are released
git fetch upstream
git merge upstream/main
# While working on assignments
cd mp1a-recursion
stack ghci # Interactive development
stack test # Run tests
# Committing your work
git add .
git commit -m "Descriptive message"
git push origin mainHappy coding!