on master help sign in
renamed Union -> Alternative
08e2a6aSönke Hahn
servant.cabal+1−1
@@ -28,7 +28,7 @@ library
28 Servant.API.QQ
28 Servant.API.QQ
29 Servant.API.Raw
29 Servant.API.Raw
30 Servant.API.Sub
30 Servant.API.Sub
31− Servant.API.Union
31+ Servant.API.Alternative
32 Servant.Utils.Text
32 Servant.Utils.Text
33 build-depends:
33 build-depends:
34 base >=4.7 && <5
34 base >=4.7 && <5
src/Servant/API.hs+2−2
@@ -4,7 +4,7 @@ module Servant.API (
4 -- | Type-level combinator for expressing subrouting: @':>'@
4 -- | Type-level combinator for expressing subrouting: @':>'@
5 module Servant.API.Sub,
5 module Servant.API.Sub,
6 -- | Type-level combinator for alternative endpoints: @':<|>'@
6 -- | Type-level combinator for alternative endpoints: @':<|>'@
7− module Servant.API.Union,
7+ module Servant.API.Alternative,
8
8
9 -- * Accessing information from the request
9 -- * Accessing information from the request
10 -- | Capturing parts of the url path as parsed values: @'Capture'@
10 -- | Capturing parts of the url path as parsed values: @'Capture'@
@@ -38,4 +38,4 @@ import Servant.API.QueryParam
38import Servant.API.QQ (sitemap)
38import Servant.API.QQ (sitemap)
39import Servant.API.ReqBody
39import Servant.API.ReqBody
40import Servant.API.Sub
40import Servant.API.Sub
41−import Servant.API.Union
41+import Servant.API.Alternative
src/Servant/API/Union.hs → src/Servant/API/Alternative.hsrenamed+1−1
@@ -1,7 +1,7 @@
1{-# LANGUAGE TypeFamilies #-}
1{-# LANGUAGE TypeFamilies #-}
2{-# LANGUAGE TypeOperators #-}
2{-# LANGUAGE TypeOperators #-}
3{-# LANGUAGE ScopedTypeVariables #-}
3{-# LANGUAGE ScopedTypeVariables #-}
4−module Servant.API.Union where
4+module Servant.API.Alternative where
5
5
6import Data.Proxy
6import Data.Proxy
7import Servant.Client
7import Servant.Client
src/Servant/API/QQ.hs+1−1
@@ -21,7 +21,7 @@ import Servant.API.Delete
21import Servant.API.QueryParam
21import Servant.API.QueryParam
22import Servant.API.ReqBody
22import Servant.API.ReqBody
23import Servant.API.Sub
23import Servant.API.Sub
24−import Servant.API.Union
24+import Servant.API.Alternative
25
25
26class ExpSYM repr' repr | repr -> repr', repr' -> repr where
26class ExpSYM repr' repr | repr -> repr', repr' -> repr where
27 lit :: String -> repr' -> repr
27 lit :: String -> repr' -> repr
test/Servant/ServerSpec.hs+5−5
@@ -27,7 +27,7 @@ import Servant.API.Post
27import Servant.API.QueryParam
27import Servant.API.QueryParam
28import Servant.API.Raw
28import Servant.API.Raw
29import Servant.API.Sub
29import Servant.API.Sub
30−import Servant.API.Union
30+import Servant.API.Alternative
31import Servant.Server
31import Servant.Server
32
32
33
33
@@ -184,20 +184,20 @@ rawSpec = do
184 simpleBody response `shouldBe` cs (show ["bar" :: String])
184 simpleBody response `shouldBe` cs (show ["bar" :: String])
185
185
186
186
187−type UnionApi =
187+type AlternativeApi =
188 "foo" :> Get Person
188 "foo" :> Get Person
189 :<|> "bar" :> Get Animal
189 :<|> "bar" :> Get Animal
190−unionApi :: Proxy UnionApi
190+unionApi :: Proxy AlternativeApi
191unionApi = Proxy
191unionApi = Proxy
192
192
193−unionServer :: Server UnionApi
193+unionServer :: Server AlternativeApi
194unionServer =
194unionServer =
195 return alice
195 return alice
196 :<|> return jerry
196 :<|> return jerry
197
197
198unionSpec :: Spec
198unionSpec :: Spec
199unionSpec = do
199unionSpec = do
200− describe "Servant.API.Union" $ do
200+ describe "Servant.API.Alternative" $ do
201 with (return $ serve unionApi unionServer) $ do
201 with (return $ serve unionApi unionServer) $ do
202 it "unions endpoints" $ do
202 it "unions endpoints" $ do
203 response <- get "/foo"
203 response <- get "/foo"