Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve custom-operator precedences #11

Closed
wants to merge 1 commit into from

Conversation

inamiy
Copy link
Collaborator

@inamiy inamiy commented Mar 15, 2016

This is a pull-request for #9 to conform the same operator-precedences as following libraries:

As a side note,

  • infix operator <|> { associativity right } was slightly faster than associativity left (interesting), but I decided to conform to current Haskell's infixl 3 <|> with precedence 125.
    • precedence 125 comes from middle value of infix 2 (precedence 120) and infix 4 (precedence 130) in typelift/Operadics.

@koher
Copy link
Collaborator

koher commented Mar 16, 2016

I'm not sure if we should introduce a new precedence 125 for <|> because someone who want to introduce a operator compatible with infixl 3 does not necessarily use 125 for it. It can be anything between 121 and 129. Introducing a new precedence can always make an incompatibility. So I hesitate it.

Using ?? as <|> make it incompatible with Haskell. However it keeps compatibilities in Swift. I think it depends on the purpose of TryParsec whether we should use ?? instead of <|>. If we want to provide TryParsec to people who are familiar with Haskell, it may be a problem. Otherwise, I think ?? is OK.

@koher koher assigned inamiy and unassigned koher Mar 16, 2016
@inamiy
Copy link
Collaborator Author

inamiy commented Mar 17, 2016

Let's keep Haskell-style writing so that current codes stay beautiful with angle-brackets all over the place 😁

(As already discussed in #9, I still find ?? difficult to read because I normally use it as fromMaybe, and <|> truly represents "or" operator since | is inside.)

@koher
Copy link
Collaborator

koher commented Mar 18, 2016

Sorry for my late response💦

I see😉 I think consistency in codes is important too.

@inamiy
Copy link
Collaborator Author

inamiy commented Sep 22, 2016

I will close this old PR. This is now superseded by #15.

@inamiy inamiy closed this Sep 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants