Stream: ideas

Topic: ignore fields in record builders


view this post on Zulip Agus Zubiaga (Jun 22 2024 at 21:51):

As part of rewriting record builders, I'd like to make it possible to have bits that are included in the chain, but whose values are ignored.

I think would be particularly helpful for parser combinators:

Parser.combine <- {
    year: Parser.int,
    _: Parser.symbol "/",
    month: Parser.int,
    _: Parser.symbol "/",
    day: Parser.int,
}

However, it'd also be useful for Task when you only care about the result of some in the batch.

view this post on Zulip Brendan Hansknecht (Jun 23 2024 at 04:22):

So the _ would not record a value, but would still be able to lead to a failure that is recorded by the combined parser?

view this post on Zulip Agus Zubiaga (Jun 23 2024 at 05:04):

Yeah, Parser.symbol "/" would still be chained with Parser.combine like the rest, but the value it produces would be ignored and won’t appear in the record

view this post on Zulip Agus Zubiaga (Jun 23 2024 at 05:07):

So it produces the effect and failures can propagate, we just don’t care about the result ok value

view this post on Zulip Brendan Hansknecht (Jun 23 2024 at 05:22):

Sounds awesome


Last updated: Jun 16 2026 at 16:19 UTC