From dee47654f9d1b0fe6c41330752512643a1deb47e Mon Sep 17 00:00:00 2001 From: "Julian K. Arni" Date: Tue, 25 Nov 2014 16:35:56 +0100 Subject: [PATCH] Rename ApiQuasiQuoting. And fix haddocks for it. --- servant.cabal | 2 +- src/Servant.hs | 4 ++-- src/Servant/API.hs | 4 ++-- src/Servant/{Utils/ApiQuasiQuoting.hs => QQ.hs} | 12 ++++-------- src/Servant/Utils/Links.hs | 1 + .../{Utils/ApiQuasiQuotingSpec.hs => QQSpec.hs} | 2 +- 6 files changed, 11 insertions(+), 14 deletions(-) rename src/Servant/{Utils/ApiQuasiQuoting.hs => QQ.hs} (96%) rename test/Servant/{Utils/ApiQuasiQuotingSpec.hs => QQSpec.hs} (99%) diff --git a/servant.cabal b/servant.cabal index 52d039a7..c0048a12 100644 --- a/servant.cabal +++ b/servant.cabal @@ -31,8 +31,8 @@ library Servant.Common.Req Servant.Common.Text Servant.Docs + Servant.QQ Servant.Server - Servant.Utils.ApiQuasiQuoting Servant.Utils.Links Servant.Utils.StaticFiles build-depends: diff --git a/src/Servant.hs b/src/Servant.hs index 69fb50a2..a6263ab7 100644 --- a/src/Servant.hs +++ b/src/Servant.hs @@ -12,7 +12,7 @@ module Servant ( -- | Using your types in request paths and query string parameters module Servant.Common.Text, -- | Utilities on top of the servant core - module Servant.Utils.ApiQuasiQuoting, + module Servant.QQ, module Servant.Utils.Links, module Servant.Utils.StaticFiles, -- | Useful re-exports @@ -25,6 +25,6 @@ import Servant.Client import Servant.Common.Text import Servant.Docs import Servant.Server -import Servant.Utils.ApiQuasiQuoting +import Servant.QQ import Servant.Utils.Links import Servant.Utils.StaticFiles diff --git a/src/Servant/API.hs b/src/Servant/API.hs index 76b4fbcc..c5a7a288 100644 --- a/src/Servant/API.hs +++ b/src/Servant/API.hs @@ -31,7 +31,7 @@ module Servant.API ( -- * Utilities -- | QuasiQuotes for endpoints - module Servant.Utils.ApiQuasiQuoting, + module Servant.QQ, -- | Type-safe internal URLs module Servant.Utils.Links, ) where @@ -46,6 +46,6 @@ import Servant.API.QueryParam import Servant.API.Raw import Servant.API.ReqBody import Servant.API.Sub -import Servant.Utils.ApiQuasiQuoting (sitemap) +import Servant.QQ (sitemap) import Servant.Utils.Links (mkLink) import Servant.Utils.StaticFiles diff --git a/src/Servant/Utils/ApiQuasiQuoting.hs b/src/Servant/QQ.hs similarity index 96% rename from src/Servant/Utils/ApiQuasiQuoting.hs rename to src/Servant/QQ.hs index 9337a42d..a886c90f 100644 --- a/src/Servant/Utils/ApiQuasiQuoting.hs +++ b/src/Servant/QQ.hs @@ -21,12 +21,12 @@ -- -- @ -- "hello" :> ReqBody String :> Put () --- :<|> "hello" :> Capture "p" Int :> ReqBody String :> Post () --- :<|> "hello" :> QueryParam "name" String :> Get Int +-- :\<|> "hello" :> Capture "p" Int :> ReqBody String :> Post () +-- :\<|> "hello" :> QueryParam "name" String :> Get Int -- @ -- --- Note the '/' before a 'QueryParam'! -module Servant.Utils.ApiQuasiQuoting where +-- Note the @/@ before a @QueryParam@! +module Servant.QQ where import Control.Monad (void) import Control.Applicative hiding (many, (<|>), optional) @@ -177,18 +177,14 @@ parseAll = do -- | The sitemap QuasiQuoter. -- -- * @.../:/...@ becomes a capture --- -- * @.../?:@ becomes a query parameter --- -- * @ ... @ becomes a method returning @@ --- -- * @ ... -> @ becomes a method with request -- body of @@ and returning @@ -- -- Comments are allowed, and have the standard Haskell format -- -- * @--@ for inline --- -- * @{- ... -}@ for block -- sitemap :: QuasiQuoter diff --git a/src/Servant/Utils/Links.hs b/src/Servant/Utils/Links.hs index f25533f5..547a3555 100644 --- a/src/Servant/Utils/Links.hs +++ b/src/Servant/Utils/Links.hs @@ -9,6 +9,7 @@ -- | Type safe internal links. -- -- Provides the function 'mkLink': +-- -- @ -- type API = Proxy ("hello" :> Get Int -- :<|> "bye" :> QueryParam "name" String :> Post Bool) diff --git a/test/Servant/Utils/ApiQuasiQuotingSpec.hs b/test/Servant/QQSpec.hs similarity index 99% rename from test/Servant/Utils/ApiQuasiQuotingSpec.hs rename to test/Servant/QQSpec.hs index 7dd3bfc1..29a680dc 100644 --- a/test/Servant/Utils/ApiQuasiQuotingSpec.hs +++ b/test/Servant/QQSpec.hs @@ -7,7 +7,7 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} -module Servant.Utils.ApiQuasiQuotingSpec where +module Servant.Utils.QQSpec where import Test.Hspec