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
I can write a function that takes a record with some default fields and directly encodes it, without providing default values. This compiles, but then results in a runtime failure.
This is a minimal example using roc-json, but I think the error is the same regardless of what encoder you use. Run the file with roc test to get the error.
thread 'main' panicked at crates/compiler/mono/src/borrow.rs:396:34:
internal error: entered unreachable code:
No borrow signature for LambdaName { name: `12.IdentId(26)`, niche: Niche(Captures([])) } layout.
Tip 1: This can happen when you call a function with less arguments than it expects.
Like `Arg.list!` instead of `Arg.list! {}`.
Tip 2: `roc check yourfile.roc` can sometimes give you a helpful error.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I don't know what the fix should be. Probably a compile time error rather than allowing the behavior at runtime? The reason I was trying this was to create a cute DSL for writing Html:
Html.ul { class: "list-of-things } [
Html.li {} [ Html.text "an item!" ],
]
# --- Html.roc
ul : { class ? Str, id ? Str, ............ }, List Html -> Html
li : { class ? Str, id ? Str, ............ }, List Html -> Html
I realize that's not what these default field types are made for though 😅
The text was updated successfully, but these errors were encountered:
I can write a function that takes a record with some default fields and directly encodes it, without providing default values. This compiles, but then results in a runtime failure.
This is a minimal example using
roc-json
, but I think the error is the same regardless of what encoder you use. Run the file withroc test
to get the error.Here's the error:
I don't know what the fix should be. Probably a compile time error rather than allowing the behavior at runtime? The reason I was trying this was to create a cute DSL for writing Html:
I realize that's not what these default field types are made for though 😅
The text was updated successfully, but these errors were encountered: