Merge pull request #762 from fierce-katie/sub-precedence-#761
Lower infix precedence for (:>) and (:<|>)
This commit is contained in:
commit
b8510edb7d
4 changed files with 9 additions and 3 deletions
|
@ -37,7 +37,7 @@ spec = do
|
||||||
|
|
||||||
it "works with operators" $ do
|
it "works with operators" $ do
|
||||||
let cxt = ((1 :: Integer) :. 'a' :. EmptyContext) :<|> ('b' :. True :. EmptyContext)
|
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
|
describe "descendIntoNamedContext" $ do
|
||||||
let cxt :: Context [Char, NamedContext "sub" '[Char]]
|
let cxt :: Context [Char, NamedContext "sub" '[Char]]
|
||||||
|
|
|
@ -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
|
0.11
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import Prelude.Compat
|
||||||
-- :}
|
-- :}
|
||||||
data a :<|> b = a :<|> b
|
data a :<|> b = a :<|> b
|
||||||
deriving (Typeable, Eq, Show, Functor, Traversable, Foldable, Bounded)
|
deriving (Typeable, Eq, Show, Functor, Traversable, Foldable, Bounded)
|
||||||
infixr 8 :<|>
|
infixr 3 :<|>
|
||||||
|
|
||||||
instance (Semigroup a, Semigroup b) => Semigroup (a :<|> b) where
|
instance (Semigroup a, Semigroup b) => Semigroup (a :<|> b) where
|
||||||
(a :<|> b) <> (a' :<|> b') = (a <> a') :<|> (b <> b')
|
(a :<|> b) <> (a' :<|> b') = (a <> a') :<|> (b <> b')
|
||||||
|
|
|
@ -16,7 +16,7 @@ import Data.Typeable (Typeable)
|
||||||
-- >>> type MyApi = "hello" :> "world" :> Get '[JSON] World
|
-- >>> type MyApi = "hello" :> "world" :> Get '[JSON] World
|
||||||
data (path :: k) :> a
|
data (path :: k) :> a
|
||||||
deriving (Typeable)
|
deriving (Typeable)
|
||||||
infixr 9 :>
|
infixr 4 :>
|
||||||
|
|
||||||
-- $setup
|
-- $setup
|
||||||
-- >>> import Servant.API
|
-- >>> import Servant.API
|
||||||
|
|
Loading…
Reference in a new issue