- Haskell 85.7%
- C 11.5%
- Nix 2.4%
- Shell 0.4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| funct-intro | ||
| haskell | ||
| learn-haskell-music | ||
| my-code | ||
| nix | ||
| .gitignore | ||
| README.md | ||
Functional Programming — A Two-Track Companion Course
Two parallel learning tracks, reinforcing each other:
| Track | Focus | Language | Goal |
|---|---|---|---|
| Haskell | Functional programming — types, purity, monads, type-driven design | Haskell | Learn to think in pure functional terms |
| Nix | Functional devops — reproducible builds, declarative systems, NixOS | Nix (the language) + NixOS | Apply functional principles to infrastructure |
Why pair them?
Haskell and Nix share deep DNA: both are purely functional, both treat configuration and programs as evaluable values, both prioritise reproducibility. The Haskell track teaches you the ideas; the Nix track shows those ideas at work on real systems — packages, services, entire operating systems.
| Haskell concept | Nix counterpart |
|---|---|
| Pure functions | Nix derivations (same inputs → same output) |
| Immutability | The /nix/store (content-addressed, never mutated) |
| Type classes | mkDerivation, callCabal2nix, etc. (combinators) |
| Laziness | Nix's lazy evaluation of derivations |
| Monadic IO | The Nix evaluator + builtins.derivation |
| Algebraic data types | Nix attrsets + the rec keyword |
Structure
functional-programming/
├── README.md ← you are here
├── haskell/
│ ├── HASKELL_OVERVIEW.md ← start here
│ ├── PATTERNS.md
│ ├── ALLIUM_RESEARCH.md
│ ├── allium-hs/ ← standalone experiment
│ └── lesson-1 .. lesson-5 ← the Haskell course
└── nix/
└── README.md ← placeholder (course not yet started)
How to use this repository
Each lesson is self-contained — cd into it, run nix develop, follow
LESSON.md. No global state, no setup beyond having Nix installed.
The recommended order:
Haskell track
- Lesson 1 — Your first TUI: pure state, pattern matching, the Elm architecture
- Lesson 2 — Async, BChan, HTTP, JSON (talking to DeepSeek)
- Lesson 3 — Types-first design: a decoupled agent protocol over NDJSON
- Lesson 3a — Refactor with view models and command types
- Lesson 4 — Testing pure functions: Hspec + QuickCheck
- Lesson 5 — Real streaming via SSE (the protocol's
Token/Donefinally used)
Nix track
Planned. Will cover: Nix the language, derivations, flakes, NixOS modules, declarative services, dev shells, and Haskell-on-Nix integration. Each lesson mirrors the Haskell worklog style.
Prerequisites
- Nix installed (with flakes enabled)
- A terminal that supports Unicode (for the TUI lessons)
- For lessons 2+: a DeepSeek API key in
~/.pi/agent/auth.json(or modify the backend to use another OpenAI-compatible endpoint)
Tooling
Every lesson ships a flake.nix providing:
- GHC (Haskell compiler) or nix itself
- cabal-install (build tool)
- haskell-language-server (IDE backend)
- ghcid (instant feedback loop)
- Hoogle (offline type search)
Run nix develop in any lesson directory. That's it.