Code examples and exercises from the "Learn You a Haskell for Great Good!" tutorial.
The repository is organized by chapters:
ch1/- Starting outch2/- Believe the typech3/- Syntax in functionsch4/- Recursionch7/- Modulesch8/- Input and outputch9/- More input and more outputch10/- Functionally solving problemsch11/- Functors, applicative functors and monoidsch13/- For a few monads morech14/- Zippersch15/- Conclusion
- Nix with flakes enabled. If flakes are not enabled on your system, you can use the one‑shot form:
nix --extra-experimental-features 'nix-command flakes' developEnter the development shell:
nix developRun examples inside the shell:
ghci ch1/baby.hs
ghc ch1/baby.hs && ./babyNot using Nix? See Running the Code (without Nix) below.
Format Nix files via the flake formatter:
nix fmtHaskell Language Server works inside the nix develop shell. Optionally use direnv to auto‑enter the dev shell in your editor.
You can compile and run individual Haskell files using GHC:
ghc filename.hs
./filenameOr load them interactively in GHCi:
ghci filename.hs