I was trying to build an example query for roc-query and was unable to get Roc to auto-generate an implementation of Decoding
for my type with a json.Option.Option
embedded in it. Here's the error I got:
── TYPE MISMATCH in example/main.roc ───────────────────────────────────────────
This expression has a type that does not implement the abilities it's expected to:
23│> Client.buildQuery "DataQuery" \{ query, book } ->
24│> Query.start {
25│> books: <-
26│> Query.start {
27│> author: <- Query.field book.author,
28│> }
29│> |> Query.object query.books,
30│> }
I can't generate an implementation of the Decoding ability for
{ books : List (Option.Option { author : Str }) }
In particular, an implementation for
Option.Option { author : Str }
cannot be generated.
Tip: Option does not implement Decoding.
It says that Option
does not implement Decoding
, but it does here in the source. Is it the case that I need to implement Decoding
myself somehow? This seems like a bug...
Yeah looks like a bug to me too.
I'll file an issue, then
Last updated: Jul 05 2025 at 12:14 UTC