From 5dd1b0351fa27bc6f823597daa1e68895dee4774 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 4 Nov 2025 15:25:02 +0000 Subject: [PATCH] Refactor README to improve Nix setup instructions Co-authored-by: sergei.petunin --- README.md | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 68c5fb8..11940dc 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,44 @@ The repository is organized by chapters: - `ch14/` - Zippers - `ch15/` - Conclusion -## Running the Code +## Prerequisites + +- Nix with flakes enabled. If flakes are not enabled on your system, you can use the one‑shot form: + +```bash +nix --extra-experimental-features 'nix-command flakes' develop +``` + +## Quick start (Nix flakes) + +Enter the development shell: + +```bash +nix develop +``` + +Run examples inside the shell: + +```bash +ghci ch1/baby.hs +ghc ch1/baby.hs && ./baby +``` + +Not using Nix? See Running the Code (without Nix) below. + +## Formatting + +Format Nix files via the flake formatter: + +```bash +nix fmt +``` + +## Editor integration + +Haskell Language Server works inside the `nix develop` shell. Optionally use `direnv` to auto‑enter the dev shell in your editor. + +## Running the Code (without Nix) You can compile and run individual Haskell files using GHC: