A comprehensive collection of solutions to the famous 99 Haskell Problems, designed to help developers learn and practice functional programming concepts in Haskell.
The 99 Haskell Problems are a collection of programming exercises that cover fundamental concepts in functional programming, including:
- List Processing (Problems 1-28): Working with lists, recursion, and basic data manipulation
- Arithmetic (Problems 31-41): Mathematical computations and number theory
- Logic and Codes (Problems 46-50): Boolean logic and binary representations
- Binary Trees (Problems 54-69): Tree data structures and algorithms
- Multiway Trees (Problems 70-73): Complex tree structures
- Graphs (Problems 80-89): Graph theory and algorithms
- Miscellaneous (Problems 90-99): Advanced topics and puzzles
Each problem includes comprehensive test suites with both unit tests and property-based tests using QuickCheck to ensure correctness and robustness of the solutions.
To run all tests:
cabal testThis will:
- Build all problem modules
- Run the comprehensive HSpec test suite
- Execute QuickCheck property tests
The project uses Nix for development environment setup:
nix developTo format all Haskell files with ormolu:
./format.shOr manually format specific files:
ormolu --mode inplace src/Problem*.hs test/*.hsThe CI checks ensure all code is properly formatted using ormolu.
To set up pre-commit hooks that automatically check formatting and linting:
# Install pre-commit (if not already installed)
pip install pre-commit
# Install the hooks
pre-commit install
# Run hooks on all files (optional)
pre-commit run --all-filesThe hooks will automatically run ormolu and hlint checks before each commit.
Problem*.hs- Solution modules for each problemtest/Problem*Spec.hs- Test specifications for each problemtest/Spec.hs- Main test runner using hspec-discover