From 505ca457cc6830f8b9758e22d706a4d3c3b0da22 Mon Sep 17 00:00:00 2001 From: Catherine Galkina Date: Fri, 2 Jun 2017 18:11:05 +0300 Subject: [PATCH 1/3] Lower Sub and Alternative infix precedence to 4 and 3 respectively --- servant/src/Servant/API/Alternative.hs | 2 +- servant/src/Servant/API/Sub.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/servant/src/Servant/API/Alternative.hs b/servant/src/Servant/API/Alternative.hs index 130f7529..a9acbb08 100644 --- a/servant/src/Servant/API/Alternative.hs +++ b/servant/src/Servant/API/Alternative.hs @@ -22,7 +22,7 @@ import Prelude.Compat -- :} data a :<|> b = a :<|> b deriving (Typeable, Eq, Show, Functor, Traversable, Foldable, Bounded) -infixr 8 :<|> +infixr 3 :<|> instance (Semigroup a, Semigroup b) => Semigroup (a :<|> b) where (a :<|> b) <> (a' :<|> b') = (a <> a') :<|> (b <> b') diff --git a/servant/src/Servant/API/Sub.hs b/servant/src/Servant/API/Sub.hs index 616ecb2a..152293e4 100644 --- a/servant/src/Servant/API/Sub.hs +++ b/servant/src/Servant/API/Sub.hs @@ -16,7 +16,7 @@ import Data.Typeable (Typeable) -- >>> type MyApi = "hello" :> "world" :> Get '[JSON] World data (path :: k) :> a deriving (Typeable) -infixr 9 :> +infixr 4 :> -- $setup -- >>> import Servant.API From e413310d0a2cb53a28bfd29021f71f65b2a1e0a4 Mon Sep 17 00:00:00 2001 From: Catherine Galkina Date: Fri, 2 Jun 2017 18:18:42 +0300 Subject: [PATCH 2/3] Update changelog --- servant/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/servant/CHANGELOG.md b/servant/CHANGELOG.md index a2f9cec5..953db7fa 100644 --- a/servant/CHANGELOG.md +++ b/servant/CHANGELOG.md @@ -1,3 +1,9 @@ +Unreleased changes +--- + +- Lower `:>` and `:<|>` infix precedence to 4 and 3 respectively + ([#761](https://github.com/haskell-servant/servant/issues/761)) + 0.11 ---- From 1c6927d3f5bbce4dbf4ebccdf156edc1f6310867 Mon Sep 17 00:00:00 2001 From: Catherine Galkina Date: Fri, 2 Jun 2017 18:47:28 +0300 Subject: [PATCH 3/3] Fix tests for servant-server --- servant-server/test/Servant/Server/Internal/ContextSpec.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servant-server/test/Servant/Server/Internal/ContextSpec.hs b/servant-server/test/Servant/Server/Internal/ContextSpec.hs index 887f7269..3e2faa45 100644 --- a/servant-server/test/Servant/Server/Internal/ContextSpec.hs +++ b/servant-server/test/Servant/Server/Internal/ContextSpec.hs @@ -37,7 +37,7 @@ spec = do it "works with operators" $ do let cxt = ((1 :: Integer) :. 'a' :. EmptyContext) :<|> ('b' :. True :. EmptyContext) - show cxt `shouldBe` "(1 :. 'a' :. EmptyContext) :<|> ('b' :. True :. EmptyContext)" + show cxt `shouldBe` "1 :. 'a' :. EmptyContext :<|> 'b' :. True :. EmptyContext" describe "descendIntoNamedContext" $ do let cxt :: Context [Char, NamedContext "sub" '[Char]]