on master help sign in
Merge pull request #762 from fierce-katie/sub-precedence-#761

Lower infix precedence for (:>) and (:<|>)

commitb8510edb7d8778e8c0105b0ec264f977df1a2637 authorOleg Grenrus <oleg.grenrus@iki.fi> dateSat 3 Jun 2017, 21:36 (9 years ago) parentcc13d621c6927d
4 files changed+9−3
servant-server/test/Servant/Server/Internal/ContextSpec.hs+1−1 servant/CHANGELOG.md+6 servant/src/Servant/API/Alternative.hs+1−1 servant/src/Servant/API/Sub.hs+1−1
servant-server/test/Servant/Server/Internal/ContextSpec.hs+1−1
@@ -37,7 +37,7 @@ spec = do
3737
3838 it "works with operators" $ do
3939 let cxt = ((1 :: Integer) :. 'a' :. EmptyContext) :<|> ('b' :. True :. EmptyContext)
40− show cxt `shouldBe` "(1 :. 'a' :. EmptyContext) :<|> ('b' :. True :. EmptyContext)"
40+ show cxt `shouldBe` "1 :. 'a' :. EmptyContext :<|> 'b' :. True :. EmptyContext"
4141
4242 describe "descendIntoNamedContext" $ do
4343 let cxt :: Context [Char, NamedContext "sub" '[Char]]
servant/CHANGELOG.md+6
@@ -1,3 +1,9 @@
1+Unreleased changes
2+---
3+
4+- Lower `:>` and `:<|>` infix precedence to 4 and 3 respectively
5+ ([#761](https://github.com/haskell-servant/servant/issues/761))
6+
170.11
28----
39
servant/src/Servant/API/Alternative.hs+1−1
@@ -22,7 +22,7 @@ import Prelude.Compat
2222-- :}
2323data a :<|> b = a :<|> b
2424 deriving (Typeable, Eq, Show, Functor, Traversable, Foldable, Bounded)
25−infixr 8 :<|>
25+infixr 3 :<|>
2626
2727instance (Semigroup a, Semigroup b) => Semigroup (a :<|> b) where
2828 (a :<|> b) <> (a' :<|> b') = (a <> a') :<|> (b <> b')
servant/src/Servant/API/Sub.hs+1−1
@@ -16,7 +16,7 @@ import Data.Typeable (Typeable)
1616-- >>> type MyApi = "hello" :> "world" :> Get '[JSON] World
1717data (path :: k) :> a
1818 deriving (Typeable)
19−infixr 9 :>
19+infixr 4 :>
2020
2121-- $setup
2222-- >>> import Servant.API