A repository implementing basic algorithms in Haskell.
- Data Structure
- Singly Linked List
- Stack
- Hash Table
- Tree
- Set (balanced binary tree): a set implemented as a balanced binary tree, based on Functional Pearls Efficient sets—a balancing act and Haskell Data.Set.Internal
- Finger Trees: a sequence built on 2-3 finger trees that gives fast access to both ends, based on Finger trees: a simple general-purpose data structure
- Search
- Sort
- Math
- Euclidean Algorithm: GCD (Greatest Common Divisor), LCM (Least Common Multiple)
- Prime Numbers: Sieve of Eratosthenes
- Fermat's Little Theorem
- Fibonacci
- Pi Approximation
- Base N
- Newton's Method: square root by the Newton-Raphson method
- Compression
- Technique
- Cumulative Sum: prefix sum, range sum query in O(1)
- Why Functional Programming Matters: the paper's sample code rewritten in Haskell.
For details, see flake.nix.
GitHub Actions runs on every push (see ci.yml):
treefmt --ci: check formatting (ormolu, nixfmt, mdformat).- check.sh: compile all
*.hsfiles withghc -Walland run them. Build artifacts go to a temporary directory, so nothing is left in the repository. You can also run it locally:nix develop --command ./check.sh
- Finger trees: a simple general-purpose data structure
- Functional Pearls Efficient sets—a balancing act