Skip to content

Does it bother anybody else that <~ is lower precedence than ~ and ~>? #517

Closed
@toddobryan

Description

@toddobryan

This has been freaking me out recently. Given,

a: Parser[A]
b: Parser[B]
c: Parser[C]
d: Parser[D]
a ~ b ~ c ~ d // => Parser[A ~ B ~ C ~ D]
a ~ b ~> c ~ d // => Parser[A ~ C ~ D] (edit: should be Parser[C ~ D])
a ~ b <~ c ~ d // => Parser[A ~ B]

because <~ is lower precedence than ~ and ~>. So you have to add parentheses if you want things to work as you might expect in a left-to-right fashion, i.e.

a ~ (b <~ c) ~ d // => Parser[A ~ B ~ D]

What would people think of adding an alias of ~< for <~, which would have the same precedence as the other two, so

a ~ b ~< c ~ d // => Parser[A ~ B ~ D]

Or maybe I'm the only one who is freaked out/annoyed by this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions