Does the new compiler derive Encoding/Decoding for opaque types yet, or is that not in? Username := Str gives MISSING METHOD … encoder_for (records/lists/tuples/tag unions all derive fine). The old Rust compiler did it for opaques aliasing a builtin, and the docs still describe it — so I wasn't sure if it's a known gap or a deliberate change.
Context: I'm deriving OpenAPI straight from Roc types, and this is the one thing keeping a refined Username := Str from being a wire field (I re-validate at the boundary for now). Happy to file a minimal repro if useful.
you should be able to do encoder_for : _ and parser_for : _ in the opaque type declaration and that should give you auto-generated implementations for them
lmk if that doesn't work though!
That did it — thanks! I'd been writing a manual encoder_for body for a custom format and missing the plain encoder_for : _ / parser_for : _; the bare : _ auto-derives the JSON codec, and a record with the opaque field round-trips now. :folded_hands:
Dzmitry Misiuk has marked this topic as resolved.
Dzmitry Misiuk has marked this topic as resolved.
Last updated: Aug 12 2026 at 12:35 UTC