I'm trying to use record destructuring but one of the fields isn't used. Is there a way to get rid of the warning?
state is not used anywhere in your code.
11│ { state, value } = Random.rangeU32 randomState 0 10
If I replace it with _, I get this error:
I am partway through parsing a record, but I got stuck here:
1│ app [main] {
2│ pf: platform "../platform/main.roc",
3│ }
4│
5│ import pf.Random
6│ import pf.Stdout
7│
8│ main : Task {} {}
9│ main =
10│ randomState = Random.init 0
11│ { _, value } = Random.rangeU32 randomState 0 10
^
TODO provide more context.
You can do either of these:
{ state: _, value } = Random.rangeU32 randomState 0 10
{ value } = Random.rangeU32 randomState 0 10
Obviously, the second is generally the cleaner solution, but the first is more explicit.
fantastic
Last updated: Jul 06 2025 at 12:14 UTC