on master help sign in
Reformat servant
8058891Oleg Grenrus
.stylish-haskell.yaml+4−3
@@ -184,6 +184,7 @@ newline: lf
184# needs to be aware of these, so it can parse the file correctly.
184# needs to be aware of these, so it can parse the file correctly.
185#
185#
186# No language extensions are enabled by default.
186# No language extensions are enabled by default.
187−# language_extensions:
187+language_extensions:
188+ - FlexibleContexts
188− # - TemplateHaskell
189+ - TemplateHaskell
189− # - QuasiQuotes
190+ - QuasiQuotes
servant/src/Servant/API.hs+67−63
@@ -66,71 +66,75 @@ module Servant.API (
66 -- * Utilities
66 -- * Utilities
67 module Servant.Utils.Links,
67 module Servant.Utils.Links,
68 -- | Type-safe internal URIs
68 -- | Type-safe internal URIs
69−
69+
70 -- * Re-exports
70 -- * Re-exports
71 If,
71 If,
72 SBool (..), SBoolI (..)
72 SBool (..), SBoolI (..)
73 ) where
73 ) where
74
74
75+import Data.Singletons.Bool
76+ (SBool (..), SBoolI (..))
77+import Data.Type.Bool
78+ (If)
75−import Servant.API.Alternative ((:<|>) (..))
79+import Servant.API.Alternative
80+ ((:<|>) (..))
76−import Servant.API.BasicAuth (BasicAuth,BasicAuthData(..))
81+import Servant.API.BasicAuth
82+ (BasicAuth, BasicAuthData (..))
83+import Servant.API.Capture
77−import Servant.API.Capture (Capture, Capture', CaptureAll)
84+ (Capture, Capture', CaptureAll)
78−import Servant.API.ContentTypes (Accept (..), FormUrlEncoded,
85+import Servant.API.ContentTypes
79− JSON,
86+ (Accept (..), FormUrlEncoded, JSON, MimeRender (..),
80− MimeRender (..), NoContent (NoContent),
81− MimeUnrender (..), OctetStream,
87+ MimeUnrender (..), NoContent (NoContent), OctetStream,
82− PlainText)
88+ PlainText)
83−import Servant.API.Description (Description, Summary)
89+import Servant.API.Description
90+ (Description, Summary)
84−import Servant.API.Empty (EmptyAPI (..))
91+import Servant.API.Empty
92+ (EmptyAPI (..))
85−import Servant.API.Experimental.Auth (AuthProtect)
93+import Servant.API.Experimental.Auth
94+ (AuthProtect)
86−import Servant.API.Header (Header, Header')
95+import Servant.API.Header
96+ (Header, Header')
87−import Servant.API.HttpVersion (HttpVersion (..))
97+import Servant.API.HttpVersion
98+ (HttpVersion (..))
88−import Servant.API.IsSecure (IsSecure (..))
99+import Servant.API.IsSecure
100+ (IsSecure (..))
89−import Servant.API.Modifiers (Required, Optional, Lenient, Strict)
101+import Servant.API.Modifiers
102+ (Lenient, Optional, Required, Strict)
90−import Servant.API.QueryParam (QueryFlag, QueryParam, QueryParam',
103+import Servant.API.QueryParam
91− QueryParams)
104+ (QueryFlag, QueryParam, QueryParam', QueryParams)
92−import Servant.API.Raw (Raw)
105+import Servant.API.Raw
106+ (Raw)
93−import Servant.API.Stream (Stream, StreamGet, StreamPost,
107+import Servant.API.RemoteHost
94− StreamGenerator (..),
95− ToStreamGenerator (..),
96− ResultStream(..), BuildFromStream (..),
97− ByteStringParser (..),
98− FramingRender (..), BoundaryStrategy (..),
99− FramingUnrender (..),
100− NewlineFraming,
101− NetstringFraming)
102−import Servant.API.RemoteHost (RemoteHost)
108+ (RemoteHost)
103−import Servant.API.ReqBody (ReqBody, ReqBody')
109+import Servant.API.ReqBody
110+ (ReqBody, ReqBody')
104−import Servant.API.ResponseHeaders (AddHeader, addHeader, noHeader,
111+import Servant.API.ResponseHeaders
105− BuildHeadersTo (buildHeadersTo),
112+ (AddHeader, BuildHeadersTo (buildHeadersTo),
106− GetHeaders (getHeaders),
113+ GetHeaders (getHeaders), HList (..), Headers (..),
107− HList (..), Headers (..),
108− getHeadersHList, getResponse, ResponseHeader (..))
114+ ResponseHeader (..), addHeader, getHeadersHList, getResponse,
115+ noHeader)
116+import Servant.API.Stream
117+ (BoundaryStrategy (..), BuildFromStream (..),
118+ ByteStringParser (..), FramingRender (..),
119+ FramingUnrender (..), NetstringFraming, NewlineFraming,
120+ ResultStream (..), Stream, StreamGenerator (..), StreamGet,
121+ StreamPost, ToStreamGenerator (..))
109−import Servant.API.Sub ((:>))
122+import Servant.API.Sub
123+ ((:>))
110−import Servant.API.Vault (Vault)
124+import Servant.API.Vault
125+ (Vault)
111−import Servant.API.Verbs (PostCreated, Delete, DeleteAccepted,
126+import Servant.API.Verbs
112− DeleteNoContent,
127+ (Delete, DeleteAccepted, DeleteNoContent,
113− DeleteNonAuthoritative, Get,
128+ DeleteNonAuthoritative, Get, GetAccepted, GetNoContent,
114− GetAccepted, GetNoContent,
115− GetNonAuthoritative,
129+ GetNonAuthoritative, GetPartialContent, GetResetContent,
116− GetPartialContent,
117− GetResetContent,
118− Patch,
119− PatchAccepted, PatchNoContent,
130+ Patch, PatchAccepted, PatchNoContent, PatchNonAuthoritative,
120− PatchNoContent,
121− PatchNonAuthoritative, Post,
122− PostAccepted, PostNoContent,
131+ Post, PostAccepted, PostCreated, PostNoContent,
123− PostNonAuthoritative,
132+ PostNonAuthoritative, PostResetContent, Put, PutAccepted,
124− PostResetContent, Put,
125− PutAccepted, PutNoContent,
126− PutNoContent, PutNonAuthoritative,
133+ PutNoContent, PutNonAuthoritative,
127− ReflectMethod (reflectMethod),
134+ ReflectMethod (reflectMethod), StdMethod (..), Verb)
128− Verb, StdMethod(..))
129−import Servant.API.WithNamedContext (WithNamedContext)
135+import Servant.API.WithNamedContext
136+ (WithNamedContext)
130−import Servant.Utils.Links (HasLink (..), Link, IsElem, IsElem',
137+import Servant.Utils.Links
131− URI (..), safeLink)
138+ (HasLink (..), IsElem, IsElem', Link, URI (..), safeLink)
132−import Web.HttpApiData (FromHttpApiData (..),
139+import Web.HttpApiData
133− ToHttpApiData (..))
140+ (FromHttpApiData (..), ToHttpApiData (..))
134−
135−import Data.Type.Bool (If)
136−import Data.Singletons.Bool (SBool (..), SBoolI (..))
servant/src/Servant/API/Alternative.hs+5−3
@@ -1,14 +1,16 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
2{-# LANGUAGE DeriveDataTypeable #-}
2{-# LANGUAGE DeriveDataTypeable #-}
3−{-# LANGUAGE DeriveFunctor #-}
4{-# LANGUAGE DeriveFoldable #-}
3{-# LANGUAGE DeriveFoldable #-}
4+{-# LANGUAGE DeriveFunctor #-}
5{-# LANGUAGE DeriveTraversable #-}
5{-# LANGUAGE DeriveTraversable #-}
6{-# LANGUAGE TypeOperators #-}
6{-# LANGUAGE TypeOperators #-}
7{-# OPTIONS_HADDOCK not-home #-}
7{-# OPTIONS_HADDOCK not-home #-}
8module Servant.API.Alternative ((:<|>)(..)) where
8module Servant.API.Alternative ((:<|>)(..)) where
9
9
10−import Data.Semigroup (Semigroup (..))
10+import Data.Semigroup
11+ (Semigroup (..))
11−import Data.Typeable (Typeable)
12+import Data.Typeable
13+ (Typeable)
12import Prelude ()
14import Prelude ()
13import Prelude.Compat
15import Prelude.Compat
14
16
servant/src/Servant/API/BasicAuth.hs+9−6
@@ -1,13 +1,16 @@
1−{-# LANGUAGE DataKinds #-}
1+{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DeriveDataTypeable #-}
2{-# LANGUAGE DeriveDataTypeable #-}
3−{-# LANGUAGE KindSignatures #-}
3+{-# LANGUAGE KindSignatures #-}
4−{-# LANGUAGE PolyKinds #-}
4+{-# LANGUAGE PolyKinds #-}
5
5
6module Servant.API.BasicAuth where
6module Servant.API.BasicAuth where
7
7
8−import Data.ByteString (ByteString)
8+import Data.ByteString
9+ (ByteString)
9−import Data.Typeable (Typeable)
10+import Data.Typeable
11+ (Typeable)
10−import GHC.TypeLits (Symbol)
12+import GHC.TypeLits
13+ (Symbol)
11
14
12
15
13-- | Combinator for <https://tools.ietf.org/html/rfc2617#section-2 Basic Access Authentication>.
16-- | Combinator for <https://tools.ietf.org/html/rfc2617#section-2 Basic Access Authentication>.
servant/src/Servant/API/Capture.hs+4−2
@@ -4,8 +4,10 @@
4{-# OPTIONS_HADDOCK not-home #-}
4{-# OPTIONS_HADDOCK not-home #-}
5module Servant.API.Capture (Capture, Capture', CaptureAll) where
5module Servant.API.Capture (Capture, Capture', CaptureAll) where
6
6
7−import Data.Typeable (Typeable)
7+import Data.Typeable
8+ (Typeable)
8−import GHC.TypeLits (Symbol)
9+import GHC.TypeLits
10+ (Symbol)
9-- | Capture a value from the request path under a certain type @a@.
11-- | Capture a value from the request path under a certain type @a@.
10--
12--
11-- Example:
13-- Example:
servant/src/Servant/API/ContentTypes.hs+21−15
@@ -71,32 +71,38 @@ module Servant.API.ContentTypes
71 , canHandleAcceptH
71 , canHandleAcceptH
72 ) where
72 ) where
73
73
74−import Control.Arrow (left)
74+import Control.Arrow
75+ (left)
75import Control.Monad.Compat
76import Control.Monad.Compat
77+import Data.Aeson
76−import Data.Aeson (FromJSON(..), ToJSON(..), encode)
78+ (FromJSON (..), ToJSON (..), encode)
77−import Data.Aeson.Parser (value)
79+import Data.Aeson.Parser
80+ (value)
78−import Data.Aeson.Types (parseEither)
81+import Data.Aeson.Types
82+ (parseEither)
79−import Data.Attoparsec.ByteString.Char8 (endOfInput, parseOnly,
83+import Data.Attoparsec.ByteString.Char8
80− skipSpace, (<?>))
84+ (endOfInput, parseOnly, skipSpace, (<?>))
81import qualified Data.ByteString as BS
85import qualified Data.ByteString as BS
82−import Data.ByteString.Lazy (ByteString, fromStrict,
86+import Data.ByteString.Lazy
83− toStrict)
87+ (ByteString, fromStrict, toStrict)
84import qualified Data.ByteString.Lazy.Char8 as BC
88import qualified Data.ByteString.Lazy.Char8 as BC
85import qualified Data.List.NonEmpty as NE
89import qualified Data.List.NonEmpty as NE
86−import Data.Maybe (isJust)
90+import Data.Maybe
91+ (isJust)
87−import Data.String.Conversions (cs)
92+import Data.String.Conversions
93+ (cs)
88import qualified Data.Text as TextS
94import qualified Data.Text as TextS
89import qualified Data.Text.Encoding as TextS
95import qualified Data.Text.Encoding as TextS
90import qualified Data.Text.Lazy as TextL
96import qualified Data.Text.Lazy as TextL
91import qualified Data.Text.Lazy.Encoding as TextL
97import qualified Data.Text.Lazy.Encoding as TextL
92import Data.Typeable
98import Data.Typeable
93−import GHC.Generics (Generic)
99+import GHC.Generics
100+ (Generic)
94import qualified Network.HTTP.Media as M
101import qualified Network.HTTP.Media as M
95−import Web.FormUrlEncoded (FromForm, ToForm,
96− urlEncodeAsForm,
97− urlDecodeAsForm)
98−import Prelude ()
102+import Prelude ()
99import Prelude.Compat
103import Prelude.Compat
104+import Web.FormUrlEncoded
105+ (FromForm, ToForm, urlDecodeAsForm, urlEncodeAsForm)
100
106
101#if MIN_VERSION_base(4,9,0)
107#if MIN_VERSION_base(4,9,0)
102import qualified GHC.TypeLits as TL
108import qualified GHC.TypeLits as TL
servant/src/Servant/API/Description.hs+7−4
@@ -3,8 +3,8 @@
3{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE FlexibleContexts #-}
4{-# LANGUAGE PolyKinds #-}
4{-# LANGUAGE PolyKinds #-}
5{-# LANGUAGE ScopedTypeVariables #-}
5{-# LANGUAGE ScopedTypeVariables #-}
6−{-# LANGUAGE TypeOperators #-}
7{-# LANGUAGE TypeFamilies #-}
6{-# LANGUAGE TypeFamilies #-}
7+{-# LANGUAGE TypeOperators #-}
8{-# OPTIONS_HADDOCK not-home #-}
8{-# OPTIONS_HADDOCK not-home #-}
9module Servant.API.Description (
9module Servant.API.Description (
10 -- * Combinators
10 -- * Combinators
@@ -16,9 +16,12 @@ module Servant.API.Description (
16 reflectDescription,
16 reflectDescription,
17 ) where
17 ) where
18
18
19−import Data.Typeable (Typeable)
19+import Data.Proxy
20+ (Proxy (..))
21+import Data.Typeable
22+ (Typeable)
20−import GHC.TypeLits (Symbol, KnownSymbol, symbolVal)
23+import GHC.TypeLits
21−import Data.Proxy (Proxy (..))
24+ (KnownSymbol, Symbol, symbolVal)
22
25
23-- | Add a short summary for (part of) API.
26-- | Add a short summary for (part of) API.
24--
27--
servant/src/Servant/API/Empty.hs+2−1
@@ -2,7 +2,8 @@
2{-# OPTIONS_HADDOCK not-home #-}
2{-# OPTIONS_HADDOCK not-home #-}
3module Servant.API.Empty(EmptyAPI(..)) where
3module Servant.API.Empty(EmptyAPI(..)) where
4
4
5−import Data.Typeable (Typeable)
5+import Data.Typeable
6+ (Typeable)
6import Prelude ()
7import Prelude ()
7import Prelude.Compat
8import Prelude.Compat
8
9
servant/src/Servant/API/Experimental/Auth.hs+5−4
@@ -1,10 +1,11 @@
1−{-# LANGUAGE DataKinds #-}
1+{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DeriveDataTypeable #-}
2{-# LANGUAGE DeriveDataTypeable #-}
3−{-# LANGUAGE KindSignatures #-}
3+{-# LANGUAGE KindSignatures #-}
4−{-# LANGUAGE PolyKinds #-}
4+{-# LANGUAGE PolyKinds #-}
5module Servant.API.Experimental.Auth where
5module Servant.API.Experimental.Auth where
6
6
7−import Data.Typeable (Typeable)
7+import Data.Typeable
8+ (Typeable)
8
9
9-- | A generalized Authentication combinator. Use this if you have a
10-- | A generalized Authentication combinator. Use this if you have a
10-- non-standard authentication technique.
11-- non-standard authentication technique.
servant/src/Servant/API/Header.hs+4−2
@@ -6,8 +6,10 @@ module Servant.API.Header (
6 Header, Header',
6 Header, Header',
7 ) where
7 ) where
8
8
9−import Data.Typeable (Typeable)
9+import Data.Typeable
10+ (Typeable)
10−import GHC.TypeLits (Symbol)
11+import GHC.TypeLits
12+ (Symbol)
11import Servant.API.Modifiers
13import Servant.API.Modifiers
12
14
13-- | Extract the given header's value as a value of type @a@.
15-- | Extract the given header's value as a value of type @a@.
servant/src/Servant/API/HttpVersion.hs+2−1
@@ -3,7 +3,8 @@ module Servant.API.HttpVersion
3 HttpVersion(..)
3 HttpVersion(..)
4 ) where
4 ) where
5
5
6−import Network.HTTP.Types (HttpVersion (..))
6+import Network.HTTP.Types
7+ (HttpVersion (..))
7
8
8-- $httpversion
9-- $httpversion
9--
10--
servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs+1−2
@@ -1,4 +1,4 @@
1−{-# LANGUAGE DataKinds #-}
1+{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE TypeOperators #-}
2{-# LANGUAGE TypeOperators #-}
3
3
4-- | This is a module containing an API with all `Servant.API` combinators. It
4-- | This is a module containing an API with all `Servant.API` combinators. It
@@ -7,7 +7,6 @@
7module Servant.API.Internal.Test.ComprehensiveAPI where
7module Servant.API.Internal.Test.ComprehensiveAPI where
8
8
9import Data.Proxy
9import Data.Proxy
10−
11import Servant.API
10import Servant.API
12
11
13type GET = Get '[JSON] NoContent
12type GET = Get '[JSON] NoContent
servant/src/Servant/API/IsSecure.hs+4−2
@@ -1,12 +1,14 @@
1{-# LANGUAGE DeriveDataTypeable #-}
1{-# LANGUAGE DeriveDataTypeable #-}
2−{-# LANGUAGE DeriveGeneric #-}
2+{-# LANGUAGE DeriveGeneric #-}
3module Servant.API.IsSecure
3module Servant.API.IsSecure
4 ( -- $issecure
4 ( -- $issecure
5 IsSecure(..)
5 IsSecure(..)
6 ) where
6 ) where
7
7
8import Data.Typeable
8import Data.Typeable
9+ (Typeable)
9−import GHC.Generics (Generic)
10+import GHC.Generics
11+ (Generic)
10
12
11-- | Was this request made over an SSL connection?
13-- | Was this request made over an SSL connection?
12--
14--
servant/src/Servant/API/Modifiers.hs+9−5
@@ -1,6 +1,6 @@
1{-# LANGUAGE DataKinds #-}
1{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE KindSignatures #-}
3{-# LANGUAGE FlexibleContexts #-}
2{-# LANGUAGE FlexibleContexts #-}
3+{-# LANGUAGE KindSignatures #-}
4{-# LANGUAGE ScopedTypeVariables #-}
4{-# LANGUAGE ScopedTypeVariables #-}
5{-# LANGUAGE TypeFamilies #-}
5{-# LANGUAGE TypeFamilies #-}
6{-# LANGUAGE TypeOperators #-}
6{-# LANGUAGE TypeOperators #-}
@@ -19,10 +19,14 @@ module Servant.API.Modifiers (
19 unfoldRequestArgument,
19 unfoldRequestArgument,
20 ) where
20 ) where
21
21
22−import Data.Proxy (Proxy (..))
22+import Data.Proxy
23+ (Proxy (..))
23−import Data.Singletons.Bool (SBool (..), SBoolI (..))
24+import Data.Singletons.Bool
25+ (SBool (..), SBoolI (..))
24−import Data.Text (Text)
26+import Data.Text
27+ (Text)
25−import Data.Type.Bool (If)
28+import Data.Type.Bool
29+ (If)
26
30
27-- | Required argument. Not wrapped.
31-- | Required argument. Not wrapped.
28data Required
32data Required
servant/src/Servant/API/QueryParam.hs+5−3
@@ -1,12 +1,14 @@
1{-# LANGUAGE DataKinds #-}
1{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DeriveDataTypeable #-}
2{-# LANGUAGE DeriveDataTypeable #-}
3−{-# LANGUAGE TypeOperators #-}
4{-# LANGUAGE PolyKinds #-}
3{-# LANGUAGE PolyKinds #-}
4+{-# LANGUAGE TypeOperators #-}
5{-# OPTIONS_HADDOCK not-home #-}
5{-# OPTIONS_HADDOCK not-home #-}
6module Servant.API.QueryParam (QueryFlag, QueryParam, QueryParam', QueryParams) where
6module Servant.API.QueryParam (QueryFlag, QueryParam, QueryParam', QueryParams) where
7
7
8−import Data.Typeable (Typeable)
8+import Data.Typeable
9+ (Typeable)
9−import GHC.TypeLits (Symbol)
10+import GHC.TypeLits
11+ (Symbol)
10import Servant.API.Modifiers
12import Servant.API.Modifiers
11
13
12-- | Lookup the value associated to the @sym@ query string parameter
14-- | Lookup the value associated to the @sym@ query string parameter
servant/src/Servant/API/Raw.hs+3−1
@@ -2,7 +2,9 @@
2{-# OPTIONS_HADDOCK not-home #-}
2{-# OPTIONS_HADDOCK not-home #-}
3module Servant.API.Raw where
3module Servant.API.Raw where
4
4
5−import Data.Typeable (Typeable)
5+import Data.Typeable
6+ (Typeable)
7+
6-- | Endpoint for plugging in your own Wai 'Application's.
8-- | Endpoint for plugging in your own Wai 'Application's.
7--
9--
8-- The given 'Application' will get the request as received by the server, potentially with
10-- The given 'Application' will get the request as received by the server, potentially with
servant/src/Servant/API/RemoteHost.hs+1
@@ -5,6 +5,7 @@ module Servant.API.RemoteHost
5 ) where
5 ) where
6
6
7import Data.Typeable
7import Data.Typeable
8+ (Typeable)
8
9
9-- | Provides access to the host or IP address
10-- | Provides access to the host or IP address
10-- from which the HTTP request was sent.
11-- from which the HTTP request was sent.
servant/src/Servant/API/ReqBody.hs+4−3
@@ -6,8 +6,9 @@ module Servant.API.ReqBody (
6 ReqBody, ReqBody',
6 ReqBody, ReqBody',
7 ) where
7 ) where
8
8
9−import Data.Typeable (Typeable)
9+import Data.Typeable
10+ (Typeable)
10−import Servant.API.Modifiers
11+import Servant.API.Modifiers
11
12
12-- | Extract the request body as a value of type @a@.
13-- | Extract the request body as a value of type @a@.
13--
14--
@@ -17,7 +18,7 @@ import Servant.API.Modifiers
17-- >>> type MyApi = "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book
18-- >>> type MyApi = "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book
18type ReqBody = ReqBody' '[Required, Strict]
19type ReqBody = ReqBody' '[Required, Strict]
19
20
20−-- |
21+-- |
21--
22--
22-- /Note:/ 'ReqBody'' is always 'Required'.
23-- /Note:/ 'ReqBody'' is always 'Required'.
23data ReqBody' (mods :: [*]) (contentTypes :: [*]) (a :: *)
24data ReqBody' (mods :: [*]) (contentTypes :: [*]) (a :: *)
servant/src/Servant/API/ResponseHeaders.hs+14−10
@@ -34,18 +34,22 @@ module Servant.API.ResponseHeaders
34 , HList(..)
34 , HList(..)
35 ) where
35 ) where
36
36
37−import Data.ByteString.Char8 as BS (ByteString, pack, unlines, init)
37+import Data.ByteString.Char8 as BS
38−import Data.Typeable (Typeable)
38+ (ByteString, init, pack, unlines)
39−import Web.HttpApiData (ToHttpApiData, toHeader,
40− FromHttpApiData, parseHeader)
41−import qualified Data.CaseInsensitive as CI
39+import qualified Data.CaseInsensitive as CI
42import Data.Proxy
40import Data.Proxy
41+import Data.Typeable
42+ (Typeable)
43+import GHC.TypeLits
43−import GHC.TypeLits (KnownSymbol, Symbol, symbolVal)
44+ (KnownSymbol, Symbol, symbolVal)
44−import qualified Network.HTTP.Types.Header as HTTP
45+import qualified Network.HTTP.Types.Header as HTTP
45−
46+import Web.HttpApiData
46−import Servant.API.Header (Header)
47+ (FromHttpApiData, ToHttpApiData, parseHeader, toHeader)
48+
47−import Prelude ()
49+import Prelude ()
48import Prelude.Compat
50import Prelude.Compat
51+import Servant.API.Header
52+ (Header)
49
53
50-- | Response Header objects. You should never need to construct one directly.
54-- | Response Header objects. You should never need to construct one directly.
51-- Instead, use 'addOptionalHeader'.
55-- Instead, use 'addOptionalHeader'.
servant/src/Servant/API/Stream.hs+27−19
@@ -1,26 +1,34 @@
1−{-# LANGUAGE DataKinds #-}
1+{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE DeriveDataTypeable #-}
2+{-# LANGUAGE DeriveDataTypeable #-}
3−{-# LANGUAGE DeriveGeneric #-}
3+{-# LANGUAGE DeriveGeneric #-}
4−{-# LANGUAGE FlexibleInstances #-}
4+{-# LANGUAGE FlexibleInstances #-}
5−{-# LANGUAGE KindSignatures #-}
5+{-# LANGUAGE KindSignatures #-}
6−{-# LANGUAGE MultiParamTypeClasses #-}
6+{-# LANGUAGE MultiParamTypeClasses #-}
7−{-# LANGUAGE OverloadedStrings #-}
7+{-# LANGUAGE OverloadedStrings #-}
8−{-# LANGUAGE PolyKinds #-}
8+{-# LANGUAGE PolyKinds #-}
9−{-# LANGUAGE RankNTypes #-}
9+{-# LANGUAGE RankNTypes #-}
10−{-# LANGUAGE TupleSections #-}
10+{-# LANGUAGE TupleSections #-}
11{-# OPTIONS_HADDOCK not-home #-}
11{-# OPTIONS_HADDOCK not-home #-}
12
12
13module Servant.API.Stream where
13module Servant.API.Stream where
14
14
15+import Control.Arrow
16+ (first)
15−import Data.ByteString.Lazy (ByteString, empty)
17+import Data.ByteString.Lazy
18+ (ByteString, empty)
16−import qualified Data.ByteString.Lazy.Char8 as LB
19+import qualified Data.ByteString.Lazy.Char8 as LB
17−import Data.Monoid ((<>))
20+import Data.Monoid
21+ ((<>))
18−import Data.Proxy (Proxy)
22+import Data.Proxy
23+ (Proxy)
19−import Data.Typeable (Typeable)
24+import Data.Typeable
25+ (Typeable)
20−import GHC.Generics (Generic)
26+import GHC.Generics
21−import Text.Read (readMaybe)
27+ (Generic)
22−import Control.Arrow (first)
23−import Network.HTTP.Types.Method (StdMethod (..))
28+import Network.HTTP.Types.Method
29+ (StdMethod (..))
30+import Text.Read
31+ (readMaybe)
24
32
25-- | A Stream endpoint for a given method emits a stream of encoded values at a given Content-Type, delimited by a framing strategy. Steam endpoints always return response code 200 on success. Type synonyms are provided for standard methods.
33-- | A Stream endpoint for a given method emits a stream of encoded values at a given Content-Type, delimited by a framing strategy. Steam endpoints always return response code 200 on success. Type synonyms are provided for standard methods.
26data Stream (method :: k1) (framing :: *) (contentType :: *) (a :: *)
34data Stream (method :: k1) (framing :: *) (contentType :: *) (a :: *)
servant/src/Servant/API/Sub.hs+2−1
@@ -4,7 +4,8 @@
4{-# OPTIONS_HADDOCK not-home #-}
4{-# OPTIONS_HADDOCK not-home #-}
5module Servant.API.Sub ((:>)) where
5module Servant.API.Sub ((:>)) where
6
6
7−import Data.Typeable (Typeable)
7+import Data.Typeable
8+ (Typeable)
8
9
9-- | The contained API (second argument) can be found under @("/" ++ path)@
10-- | The contained API (second argument) can be found under @("/" ++ path)@
10-- (path being the first argument).
11-- (path being the first argument).
servant/src/Servant/API/TypeLevel.hs+18−9
@@ -47,16 +47,25 @@ module Servant.API.TypeLevel (
47 ) where
47 ) where
48
48
49
49
50−import GHC.Exts (Constraint)
50+import GHC.Exts
51+ (Constraint)
51−import Servant.API.Alternative (type (:<|>))
52+import Servant.API.Alternative
53+ (type (:<|>))
52−import Servant.API.Capture (Capture, CaptureAll)
54+import Servant.API.Capture
55+ (Capture, CaptureAll)
53−import Servant.API.Header (Header)
56+import Servant.API.Header
57+ (Header)
58+import Servant.API.QueryParam
54−import Servant.API.QueryParam (QueryFlag, QueryParam, QueryParams)
59+ (QueryFlag, QueryParam, QueryParams)
55−import Servant.API.ReqBody (ReqBody)
60+import Servant.API.ReqBody
61+ (ReqBody)
56−import Servant.API.Sub (type (:>))
62+import Servant.API.Sub
63+ (type (:>))
57−import Servant.API.Verbs (Verb)
64+import Servant.API.Verbs
65+ (Verb)
58#if MIN_VERSION_base(4,9,0)
66#if MIN_VERSION_base(4,9,0)
59−import GHC.TypeLits (TypeError, ErrorMessage(..))
67+import GHC.TypeLits
68+ (ErrorMessage (..), TypeError)
60#endif
69#endif
61
70
62
71
servant/src/Servant/API/Vault.hs+2−1
@@ -3,7 +3,8 @@ module Servant.API.Vault
3 Vault
3 Vault
4 ) where
4 ) where
5
5
6−import Data.Vault.Lazy (Vault)
6+import Data.Vault.Lazy
7+ (Vault)
7
8
8-- $vault
9-- $vault
9--
10--
servant/src/Servant/API/Verbs.hs+12−9
@@ -8,15 +8,18 @@ module Servant.API.Verbs
8 , StdMethod(GET, POST, HEAD, PUT, DELETE, TRACE, CONNECT, OPTIONS, PATCH)
8 , StdMethod(GET, POST, HEAD, PUT, DELETE, TRACE, CONNECT, OPTIONS, PATCH)
9 ) where
9 ) where
10
10
11−import Data.Typeable (Typeable)
11+import Data.Proxy
12+ (Proxy)
12−import Data.Proxy (Proxy)
13+import Data.Typeable
14+ (Typeable)
13−import GHC.Generics (Generic)
15+import GHC.Generics
16+ (Generic)
14−import GHC.TypeLits (Nat)
17+import GHC.TypeLits
18+ (Nat)
15−import Network.HTTP.Types.Method (Method, StdMethod (..),
19+import Network.HTTP.Types.Method
16− methodDelete, methodGet, methodHead,
20+ (Method, StdMethod (..), methodConnect, methodDelete,
17− methodPatch, methodPost, methodPut,
21+ methodGet, methodHead, methodOptions, methodPatch, methodPost,
18− methodTrace, methodConnect,
22+ methodPut, methodTrace)
19− methodOptions)
20
23
21-- | @Verb@ is a general type for representing HTTP verbs (a.k.a. methods). For
24-- | @Verb@ is a general type for representing HTTP verbs (a.k.a. methods). For
22-- convenience, type synonyms for each verb with a 200 response code are
25-- convenience, type synonyms for each verb with a 200 response code are
servant/src/Servant/API/WithNamedContext.hs+2−2
@@ -1,9 +1,9 @@
1−{-# LANGUAGE DataKinds #-}
1+{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE KindSignatures #-}
2{-# LANGUAGE KindSignatures #-}
3
3
4module Servant.API.WithNamedContext where
4module Servant.API.WithNamedContext where
5
5
6−import GHC.TypeLits
6+import GHC.TypeLits
7
7
8-- | 'WithNamedContext' names a specific tagged context to use for the
8-- | 'WithNamedContext' names a specific tagged context to use for the
9-- combinators in the API. (See also in @servant-server@,
9-- combinators in the API. (See also in @servant-server@,
servant/src/Servant/Utils/Enter.hs+4−3
@@ -13,7 +13,6 @@ module Servant.Utils.Enter {-# DEPRECATED "Use hoistServer or hoistServerWithCon
13 (:~>)(..),
13 (:~>)(..),
14 ) where
14 ) where
15
15
16−import Control.Natural
17import Control.Monad.Identity
16import Control.Monad.Identity
18import Control.Monad.Morph
17import Control.Monad.Morph
19import Control.Monad.Reader
18import Control.Monad.Reader
@@ -21,8 +20,10 @@ import qualified Control.Monad.State.Lazy as LState
21import qualified Control.Monad.State.Strict as SState
20import qualified Control.Monad.State.Strict as SState
22import qualified Control.Monad.Writer.Lazy as LWriter
21import qualified Control.Monad.Writer.Lazy as LWriter
23import qualified Control.Monad.Writer.Strict as SWriter
22import qualified Control.Monad.Writer.Strict as SWriter
23+import Control.Natural
24+import Data.Tagged
24−import Data.Tagged (Tagged, retag)
25+ (Tagged, retag)
25−import Prelude ()
26+import Prelude ()
26import Prelude.Compat
27import Prelude.Compat
27import Servant.API
28import Servant.API
28
29
servant/src/Servant/Utils/Links.hs+55−30
@@ -101,38 +101,63 @@ module Servant.Utils.Links (
101) where
101) where
102
102
103import Data.List
103import Data.List
104−import Data.Monoid.Compat ( (<>) )
104+import Data.Monoid.Compat
105+ ((<>))
105−import Data.Proxy ( Proxy(..) )
106+import Data.Proxy
107+ (Proxy (..))
106−import Data.Singletons.Bool ( SBool (..), SBoolI (..) )
108+import Data.Singletons.Bool
109+ (SBool (..), SBoolI (..))
107−import qualified Data.Text as Text
110+import qualified Data.Text as Text
108−import qualified Data.Text.Encoding as TE
111+import qualified Data.Text.Encoding as TE
109−import Data.Type.Bool (If)
112+import Data.Type.Bool
113+ (If)
114+import GHC.TypeLits
110−import GHC.TypeLits ( KnownSymbol, symbolVal )
115+ (KnownSymbol, symbolVal)
116+import Network.URI
111−import Network.URI ( URI(..), escapeURIString, isUnreserved )
117+ (URI (..), escapeURIString, isUnreserved)
112−import Prelude ()
118+import Prelude ()
113import Prelude.Compat
119import Prelude.Compat
114
120
115−import Web.HttpApiData
116−import Servant.API.Alternative ( (:<|>)((:<|>)) )
121+import Servant.API.Alternative
122+ ((:<|>) ((:<|>)))
117−import Servant.API.BasicAuth ( BasicAuth )
123+import Servant.API.BasicAuth
124+ (BasicAuth)
118−import Servant.API.Capture ( Capture', CaptureAll )
125+import Servant.API.Capture
126+ (Capture', CaptureAll)
119−import Servant.API.ReqBody ( ReqBody' )
127+import Servant.API.Description
120−import Servant.API.QueryParam ( QueryParam', QueryParams, QueryFlag )
128+ (Description, Summary)
121−import Servant.API.Header ( Header' )
122−import Servant.API.HttpVersion (HttpVersion)
123−import Servant.API.RemoteHost ( RemoteHost )
124−import Servant.API.IsSecure (IsSecure)
125−import Servant.API.Empty (EmptyAPI (..))
129+import Servant.API.Empty
130+ (EmptyAPI (..))
126−import Servant.API.Verbs ( Verb )
131+import Servant.API.Experimental.Auth
132+ (AuthProtect)
133+import Servant.API.Header
134+ (Header')
135+import Servant.API.HttpVersion
136+ (HttpVersion)
137+import Servant.API.IsSecure
138+ (IsSecure)
139+import Servant.API.Modifiers
140+ (FoldRequired)
141+import Servant.API.QueryParam
142+ (QueryFlag, QueryParam', QueryParams)
143+import Servant.API.Raw
144+ (Raw)
145+import Servant.API.RemoteHost
146+ (RemoteHost)
147+import Servant.API.ReqBody
148+ (ReqBody')
149+import Servant.API.Stream
150+ (Stream)
127−import Servant.API.Sub ( type (:>) )
151+import Servant.API.Sub
128−import Servant.API.Raw ( Raw )
152+ (type (:>))
129−import Servant.API.Stream ( Stream )
130−import Servant.API.TypeLevel
153+import Servant.API.TypeLevel
131−import Servant.API.Modifiers (FoldRequired)
154+import Servant.API.Vault
155+ (Vault)
132−import Servant.API.Description (Description, Summary)
156+import Servant.API.Verbs
133−import Servant.API.Vault (Vault)
157+ (Verb)
134−import Servant.API.WithNamedContext (WithNamedContext)
158+import Servant.API.WithNamedContext
135−import Servant.API.Experimental.Auth ( AuthProtect )
159+ (WithNamedContext)
160+import Web.HttpApiData
136
161
137-- | A safe link datatype.
162-- | A safe link datatype.
138-- The only way of constructing a 'Link' is using 'safeLink', which means any
163-- The only way of constructing a 'Link' is using 'safeLink', which means any