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
- Never manually edit generated code (e.g. proto-lens output in `gen/`). Use nix dev shell to run code generation tools (e.g. `nix develop --command bash -c "cd cardano-rpc && buf generate proto"`)
5
+
- Never modify the nix store
6
+
7
+
## cardano-rpc patterns
8
+
-`Proto msg` is a grapesy newtype wrapper. Internal functions should use plain proto-lens types, not `Proto`-wrapped. Use `getProto`/`fmap getProto` only at the RPC handler boundary.
9
+
- RIO hides many Prelude functions. `sortBy` is NOT re-exported by RIO -- import from `Data.List`. Check RIO re-exports before assuming standard functions are in scope.
10
+
- RIO's `^.` works with proto-lens van Laarhoven lenses. No need for `lens-family` dependency.
11
+
- Use `toList` (from `GHC.IsList`) instead of deprecated `valueToList` for `Value`.
12
+
13
+
## Mistakes and wrong assumptions (lessons learned)
14
+
- Assumed generated code could be patched by hand -- WRONG. Always use the project's code generation pipeline.
15
+
- Assumed proto-lens types would be used wrapped in `Proto` everywhere -- WRONG. `Proto` is only at the gRPC handler boundary. Internal logic uses raw proto-lens types.
16
+
- Assumed RIO re-exports all of `Data.List` -- WRONG. `sortBy`, `on`, and others need explicit imports.
17
+
- Assumed I needed `lens-family` for proto-lens field access -- WRONG. RIO's `^.` (from `microlens`) is compatible with proto-lens van Laarhoven lenses.
18
+
- Used deprecated `valueToList` instead of checking for the current API (`toList` via `GHC.IsList`).
19
+
- Left redundant `IsEra` constraint on `matchesTxOutputPattern` -- should check if constraints are actually needed before adding them.
20
+
- Wrote lambdas where infix notation was cleaner (`\sub -> f sub x` vs `` `f` x ``). hlint caught this.
21
+
- Minimize nix build round-trips: verify types, imports, and constraints carefully before building.
0 commit comments