{"action":"created","issue":{"url":"https://api.github.com/repos/tryswift/TryParsec/issues/9","repository_url":"https://api.github.com/repos/tryswift/TryParsec","labels_url":"https://api.github.com/repos/tryswift/TryParsec/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/tryswift/TryParsec/issues/9/comments","events_url":"https://api.github.com/repos/tryswift/TryParsec/issues/9/events","html_url":"https://github.com/tryswift/TryParsec/issues/9","id":140222884,"number":9,"title":"Operators' presedence seems incompatible with Runes' and Haskell's","user":{"login":"koher","id":217100,"avatar_url":"https://avatars.githubusercontent.com/u/217100?v=3","gravatar_id":"","url":"https://api.github.com/users/koher","html_url":"https://github.com/koher","followers_url":"https://api.github.com/users/koher/followers","following_url":"https://api.github.com/users/koher/following{/other_user}","gists_url":"https://api.github.com/users/koher/gists{/gist_id}","starred_url":"https://api.github.com/users/koher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koher/subscriptions","organizations_url":"https://api.github.com/users/koher/orgs","repos_url":"https://api.github.com/users/koher/repos","events_url":"https://api.github.com/users/koher/events{/privacy}","received_events_url":"https://api.github.com/users/koher/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-11T16:07:03Z","updated_at":"2016-03-15T16:23:24Z","closed_at":null,"body":"[Precedence of some infix operators declared in TryParsec](https://github.com/tryswift/TryParsec/blob/8946a764d46d003045993d747ec631a49fd99449/Sources/TryParsec/Operators.swift) seems incompatible with ones [in thoughtbot/Runes](https://github.com/thoughtbot/Runes/blob/42fbd8fb52b8155e3eb4ebe8b82bcea1c8d8bff6/Source/Runes.swift) and in Haskell. Any reasons for this?\r\n\r\nIn Haskell:\r\n\r\n- `<*>`: `4` https://hackage.haskell.org/package/base-4.8.2.0/docs/Control-Applicative.html#v:-60--42--62-\r\n- `<$>`: `4` http://hackage.haskell.org/package/base-4.8.2.0/docs/Control-Applicative.html#v:-60--36--62-\r\n- `<|>`: `3` http://hackage.haskell.org/package/base-4.8.2.0/docs/Control-Applicative.html#v:-60--124--62-\r\n\r\n`<*>` and `<$>`'s precedence are equal to `==`'s, and `<|>`'s is equal to `&&`'s.\r\n\r\nhttps://www.haskell.org/onlinereport/decls.html\r\n\r\nIn Swift, `==`'s precedence is `130` and `&&`'s is `120`.\r\n\r\nhttps://developer.apple.com/library/tvos/documentation/Swift/Reference/Swift_StandardLibrary_Operators/index.html#//apple_ref/doc/uid/TP40016054\r\n\r\nIn TryParsec:\r\n\r\n```swift\r\ninfix operator <|>  { associativity right precedence 130 }\r\ninfix operator <*>  { associativity left precedence 140 }\r\ninfix operator <^>  { associativity left precedence 140 }\r\n```\r\n\r\nIn Runes:\r\n\r\n```swift\r\ninfix operator <^> {\r\n    associativity left\r\n\r\n    // Same precedence as the equality operator (`==`)\r\n    precedence 130\r\n}\r\n\r\n/**\r\napply a function with context to a value with context\r\nExpected function type: `f (a -> b) -> f a -> f b`\r\n*/\r\ninfix operator <*> {\r\n    associativity left\r\n\r\n    // Same precedence as the equality operator (`==`)\r\n    precedence 130\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/tryswift/TryParsec/issues/comments/196905873","html_url":"https://github.com/tryswift/TryParsec/issues/9#issuecomment-196905873","issue_url":"https://api.github.com/repos/tryswift/TryParsec/issues/9","id":196905873,"user":{"login":"koher","id":217100,"avatar_url":"https://avatars.githubusercontent.com/u/217100?v=3","gravatar_id":"","url":"https://api.github.com/users/koher","html_url":"https://github.com/koher","followers_url":"https://api.github.com/users/koher/followers","following_url":"https://api.github.com/users/koher/following{/other_user}","gists_url":"https://api.github.com/users/koher/gists{/gist_id}","starred_url":"https://api.github.com/users/koher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koher/subscriptions","organizations_url":"https://api.github.com/users/koher/orgs","repos_url":"https://api.github.com/users/koher/repos","events_url":"https://api.github.com/users/koher/events{/privacy}","received_events_url":"https://api.github.com/users/koher/received_events","type":"User","site_admin":false},"created_at":"2016-03-15T16:23:24Z","updated_at":"2016-03-15T16:23:24Z","body":"@inamiy \r\nHow about using `??` instead of `<|>`?\r\n\r\nI think using Runes or Operadics is not so important. The important thing is to have compatible precedences, or operators may collide. Because `<*>` and `<^>`'s precedences are `130` in both Runes and Operadics, it seems good that TryParsec follows it."}}