parsec icon indicating copy to clipboard operation
parsec copied to clipboard

Why does Parsec change the fixity of `<|>`?

Open jwiegley opened this issue 9 years ago • 3 comments

In Control.Applicative, <|> is defined as having fixity infixl 3, but in Parsec it is defined as infixr 1. Is there a reason for this difference? Should Parsec be changed to match?

jwiegley avatar Oct 11 '16 03:10 jwiegley

I believe it's this way because Parsec had (<|>) before Control.Applicative became common, so it has chosen its own standards. IMO, not only precedence should be changed to match, but it should also be made an instance of Alternative and (<|>) should be just re-exported from Control.Applicative. That's what we've done in Megaparsec.

mrkkrp avatar Oct 11 '16 07:10 mrkkrp

It actually is an instance of Alternative. All we need to do is remove the fixity declaration and function definition from Prim.hs.

jwiegley avatar Oct 11 '16 15:10 jwiegley

Ah, all right then. I would say we also need to re-export things from Control.Applicative. You can open a PR and it may be merged someday.

mrkkrp avatar Oct 11 '16 15:10 mrkkrp