You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Build a cabal component with nix, parse GHC errors and warnings, fix them, and rebuild until clean.
4
+
disable-model-invocation: true
5
+
argument-hint: [nix-flake-target]
6
+
---
7
+
8
+
Build and iteratively fix GHC errors/warnings for the given nix flake target.
9
+
10
+
If no argument is given, default to `'.#cardano-rpc:lib:cardano-rpc'`.
11
+
12
+
Target: $ARGUMENTS
13
+
14
+
## Procedure
15
+
16
+
1. Run `nix build '<target>' 2>&1` and capture the output.
17
+
2. Parse the output for GHC errors and warnings.
18
+
3. If there are errors, fix them one category at a time:
19
+
-**Missing imports**: Look up which module exports the symbol. Remember that RIO does NOT re-export everything from Prelude/Data.List (e.g. `sortBy`, `on` need explicit imports).
20
+
-**Type mismatches**: Analyze carefully. In cardano-rpc, remember that `Proto msg` is a grapesy wrapper — internal functions use plain proto-lens types, `getProto`/`fmap getProto` at handler boundaries only.
21
+
-**Not in scope**: Check if it's a missing import or a typo.
22
+
-**Redundant constraints**: Remove them.
23
+
-**Redundant imports**: Remove them.
24
+
-**Deprecated functions**: Replace with the recommended alternative (e.g. `valueToList` -> `toList` from `GHC.IsList`).
25
+
4. After fixing, rebuild.
26
+
5. Repeat until the build succeeds with no errors.
27
+
6. If there are warnings remaining, fix them too:
28
+
- Redundant imports/constraints: remove
29
+
- hlint-style suggestions: apply (e.g. lambda to infix)
30
+
- Deprecated usage: replace
31
+
7. Rebuild one final time to confirm clean output.
32
+
33
+
## Important rules
34
+
- NEVER manually edit files under `gen/` — those are generated by proto-lens.
35
+
- If proto generated code needs updating, use `/proto-gen` instead.
36
+
- RIO's `^.` works with proto-lens lenses. Do NOT add `lens-family` as a dependency.
37
+
- Verify fixes carefully before rebuilding to minimize nix build round-trips (each takes minutes).
0 commit comments