Remix.run Logo
▲ codebje 6 hours ago

    A parser for a thing
    Is a function from a string
    To a list of pairs
    Of strings and things.
▲mrkeen 4 hours ago | parent [-]

If you use an Either instead of a List, then you can write an or combinator, which accepts two parsers and tries the second if the first fails. It branches on the Left/Right of the Either.

If it's a List, wouldn't you be forced to write the Cartesian product of two parsers instead?