git.iko.soy/typeable/servant
on master help sign in
Merge pull request #680 from phadej/stylish-haskell

Update .stylish-haskell

commit6d1ae0dccdf4c499d526187fd910297d54121b64 authorOleg Grenrus <oleg.grenrus@iki.fi> dateSun 11 Mar 2018, 18:28 (9 years ago) parentbcca6358058891
27 files changed+407−206
.stylish-haskell.yaml+118−5 servant/src/Servant/API.hs+67−63 servant/src/Servant/API/Alternative.hs+5−3 servant/src/Servant/API/BasicAuth.hs+9−6 servant/src/Servant/API/Capture.hs+4−2 servant/src/Servant/API/ContentTypes.hs+21−15 servant/src/Servant/API/Description.hs+7−4 servant/src/Servant/API/Empty.hs+2−1 servant/src/Servant/API/Experimental/Auth.hs+5−4 servant/src/Servant/API/Header.hs+4−2 servant/src/Servant/API/HttpVersion.hs+2−1 servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs+1−2 servant/src/Servant/API/IsSecure.hs+4−2 servant/src/Servant/API/Modifiers.hs+9−5 servant/src/Servant/API/QueryParam.hs+5−3 servant/src/Servant/API/Raw.hs+3−1 servant/src/Servant/API/RemoteHost.hs+1 servant/src/Servant/API/ReqBody.hs+4−3 servant/src/Servant/API/ResponseHeaders.hs+14−10 servant/src/Servant/API/Stream.hs+27−19 servant/src/Servant/API/Sub.hs+2−1 servant/src/Servant/API/TypeLevel.hs+18−9 servant/src/Servant/API/Vault.hs+2−1 servant/src/Servant/API/Verbs.hs+12−9 servant/src/Servant/API/WithNamedContext.hs+2−2 servant/src/Servant/Utils/Enter.hs+4−3 servant/src/Servant/Utils/Links.hs+55−30
.stylish-haskell.yaml+118−5
@@ -15,6 +15,14 @@ steps:
1515 # # true.
1616 # add_language_pragma: true
1717
18+ # Align the right hand side of some elements. This is quite conservative
19+ # and only applies to statements where each element occupies a single
20+ # line.
21+ - simple_align:
22+ cases: false
23+ top_level_patterns: false
24+ records: false
25+
1826 # Import cleanup
1927 - imports:
2028 # There are different ways we can align names and lists.
@@ -33,6 +41,91 @@ steps:
3341 # Default: global.
3442 align: global
3543
44+ # Folowing options affect only import list alignment.
45+ #
46+ # List align has following options:
47+ #
48+ # - after_alias: Import list is aligned with end of import including
49+ # 'as' and 'hiding' keywords.
50+ #
51+ # > import qualified Data.List as List (concat, foldl, foldr, head,
52+ # > init, last, length)
53+ #
54+ # - with_alias: Import list is aligned with start of alias or hiding.
55+ #
56+ # > import qualified Data.List as List (concat, foldl, foldr, head,
57+ # > init, last, length)
58+ #
59+ # - new_line: Import list starts always on new line.
60+ #
61+ # > import qualified Data.List as List
62+ # > (concat, foldl, foldr, head, init, last, length)
63+ #
64+ # Default: after_alias
65+ list_align: new_line
66+
67+ # Long list align style takes effect when import is too long. This is
68+ # determined by 'columns' setting.
69+ #
70+ # - inline: This option will put as much specs on same line as possible.
71+ #
72+ # - new_line: Import list will start on new line.
73+ #
74+ # - new_line_multiline: Import list will start on new line when it's
75+ # short enough to fit to single line. Otherwise it'll be multiline.
76+ #
77+ # - multiline: One line per import list entry.
78+ # Type with contructor list acts like single import.
79+ #
80+ # > import qualified Data.Map as M
81+ # > ( empty
82+ # > , singleton
83+ # > , ...
84+ # > , delete
85+ # > )
86+ #
87+ # Default: inline
88+ long_list_align: new_line
89+
90+ # Align empty list (importing instances)
91+ #
92+ # Empty list align has following options
93+ #
94+ # - inherit: inherit list_align setting
95+ #
96+ # - right_after: () is right after the module name:
97+ #
98+ # > import Vector.Instances ()
99+ #
100+ # Default: inherit
101+ empty_list_align: right_after
102+
103+ # List padding determines indentation of import list on lines after import.
104+ # This option affects 'long_list_align'.
105+ #
106+ # - <integer>: constant value
107+ #
108+ # - module_name: align under start of module name.
109+ # Useful for 'file' and 'group' align settings.
110+ list_padding: module_name
111+
112+ # Separate lists option affects formating of import list for type
113+ # or class. The only difference is single space between type and list
114+ # of constructors, selectors and class functions.
115+ #
116+ # - true: There is single space between Foldable type and list of it's
117+ # functions.
118+ #
119+ # > import Data.Foldable (Foldable (fold, foldl, foldMap))
120+ #
121+ # - false: There is no space between Foldable type and list of it's
122+ # functions.
123+ #
124+ # > import Data.Foldable (Foldable(fold, foldl, foldMap))
125+ #
126+ # Default: true
127+ separate_lists: true
128+
36129 # Language pragmas
37130 - language_pragmas:
38131 # We can generate different styles of language pragma lists.
@@ -47,13 +140,20 @@ steps:
47140 # Default: vertical.
48141 style: vertical
49142
143+ # Align affects alignment of closing pragma brackets.
144+ #
145+ # - true: Brackets are aligned in same collumn.
146+ #
147+ # - false: Brackets are not aligned together. There is only one space
148+ # between actual import and closing bracket.
149+ #
150+ # Default: true
151+ align: true
152+
50153 # stylish-haskell can detect redundancy of some language pragmas. If this
51154 # is set to true, it will remove those redundant pragmas. Default: true.
52155 remove_redundant: true
53156
54− # Align the types in record declarations
55− - records: {}
56−
57157 # Replace tabs by spaces. This is disabled by default.
58158 # - tabs:
59159 # # Number of spaces to use for each tab. Default: 8, as specified by the
@@ -67,11 +167,24 @@ steps:
67167# to. Different steps take this into account. Default: 80.
68168columns: 80
69169
170+# By default, line endings are converted according to the OS. You can override
171+# preferred format here.
172+#
173+# - native: Native newline format. CRLF on Windows, LF on other OSes.
174+#
175+# - lf: Convert to LF ("\n").
176+#
177+# - crlf: Convert to CRLF ("\r\n").
178+#
179+# Default: native.
180+newline: lf
181+
70182# Sometimes, language extensions are specified in a cabal file or from the
71183# command line instead of using language pragmas in the file. stylish-haskell
72184# needs to be aware of these, so it can parse the file correctly.
73185#
74186# No language extensions are enabled by default.
75187language_extensions:
76− - TemplateHaskell
77− - QuasiQuotes
188+ - FlexibleContexts
189+ - TemplateHaskell
190+ - QuasiQuotes
servant/src/Servant/API.hs+67−63
@@ -66,71 +66,75 @@ module Servant.API (
6666 -- * Utilities
6767 module Servant.Utils.Links,
6868 -- | Type-safe internal URIs
69−
69+
7070 -- * Re-exports
7171 If,
7272 SBool (..), SBoolI (..)
7373 ) where
7474
75−import Servant.API.Alternative ((:<|>) (..))
76−import Servant.API.BasicAuth (BasicAuth,BasicAuthData(..))
77−import Servant.API.Capture (Capture, Capture', CaptureAll)
78−import Servant.API.ContentTypes (Accept (..), FormUrlEncoded,
79− JSON,
80− MimeRender (..), NoContent (NoContent),
81− MimeUnrender (..), OctetStream,
82− PlainText)
83−import Servant.API.Description (Description, Summary)
84−import Servant.API.Empty (EmptyAPI (..))
85−import Servant.API.Experimental.Auth (AuthProtect)
86−import Servant.API.Header (Header, Header')
87−import Servant.API.HttpVersion (HttpVersion (..))
88−import Servant.API.IsSecure (IsSecure (..))
89−import Servant.API.Modifiers (Required, Optional, Lenient, Strict)
90−import Servant.API.QueryParam (QueryFlag, QueryParam, QueryParam',
91− QueryParams)
92−import Servant.API.Raw (Raw)
93−import Servant.API.Stream (Stream, StreamGet, StreamPost,
94− StreamGenerator (..),
95− ToStreamGenerator (..),
96− ResultStream(..), BuildFromStream (..),
97− ByteStringParser (..),
98− FramingRender (..), BoundaryStrategy (..),
99− FramingUnrender (..),
100− NewlineFraming,
101− NetstringFraming)
102−import Servant.API.RemoteHost (RemoteHost)
103−import Servant.API.ReqBody (ReqBody, ReqBody')
104−import Servant.API.ResponseHeaders (AddHeader, addHeader, noHeader,
105− BuildHeadersTo (buildHeadersTo),
106− GetHeaders (getHeaders),
107− HList (..), Headers (..),
108− getHeadersHList, getResponse, ResponseHeader (..))
109−import Servant.API.Sub ((:>))
110−import Servant.API.Vault (Vault)
111−import Servant.API.Verbs (PostCreated, Delete, DeleteAccepted,
112− DeleteNoContent,
113− DeleteNonAuthoritative, Get,
114− GetAccepted, GetNoContent,
115− GetNonAuthoritative,
116− GetPartialContent,
117− GetResetContent,
118− Patch,
119− PatchAccepted, PatchNoContent,
120− PatchNoContent,
121− PatchNonAuthoritative, Post,
122− PostAccepted, PostNoContent,
123− PostNonAuthoritative,
124− PostResetContent, Put,
125− PutAccepted, PutNoContent,
126− PutNoContent, PutNonAuthoritative,
127− ReflectMethod (reflectMethod),
128− Verb, StdMethod(..))
129−import Servant.API.WithNamedContext (WithNamedContext)
130−import Servant.Utils.Links (HasLink (..), Link, IsElem, IsElem',
131− URI (..), safeLink)
132−import Web.HttpApiData (FromHttpApiData (..),
133− ToHttpApiData (..))
134−
135−import Data.Type.Bool (If)
136−import Data.Singletons.Bool (SBool (..), SBoolI (..))
75+import Data.Singletons.Bool
76+ (SBool (..), SBoolI (..))
77+import Data.Type.Bool
78+ (If)
79+import Servant.API.Alternative
80+ ((:<|>) (..))
81+import Servant.API.BasicAuth
82+ (BasicAuth, BasicAuthData (..))
83+import Servant.API.Capture
84+ (Capture, Capture', CaptureAll)
85+import Servant.API.ContentTypes
86+ (Accept (..), FormUrlEncoded, JSON, MimeRender (..),
87+ MimeUnrender (..), NoContent (NoContent), OctetStream,
88+ PlainText)
89+import Servant.API.Description
90+ (Description, Summary)
91+import Servant.API.Empty
92+ (EmptyAPI (..))
93+import Servant.API.Experimental.Auth
94+ (AuthProtect)
95+import Servant.API.Header
96+ (Header, Header')
97+import Servant.API.HttpVersion
98+ (HttpVersion (..))
99+import Servant.API.IsSecure
100+ (IsSecure (..))
101+import Servant.API.Modifiers
102+ (Lenient, Optional, Required, Strict)
103+import Servant.API.QueryParam
104+ (QueryFlag, QueryParam, QueryParam', QueryParams)
105+import Servant.API.Raw
106+ (Raw)
107+import Servant.API.RemoteHost
108+ (RemoteHost)
109+import Servant.API.ReqBody
110+ (ReqBody, ReqBody')
111+import Servant.API.ResponseHeaders
112+ (AddHeader, BuildHeadersTo (buildHeadersTo),
113+ GetHeaders (getHeaders), HList (..), Headers (..),
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 (..))
122+import Servant.API.Sub
123+ ((:>))
124+import Servant.API.Vault
125+ (Vault)
126+import Servant.API.Verbs
127+ (Delete, DeleteAccepted, DeleteNoContent,
128+ DeleteNonAuthoritative, Get, GetAccepted, GetNoContent,
129+ GetNonAuthoritative, GetPartialContent, GetResetContent,
130+ Patch, PatchAccepted, PatchNoContent, PatchNonAuthoritative,
131+ Post, PostAccepted, PostCreated, PostNoContent,
132+ PostNonAuthoritative, PostResetContent, Put, PutAccepted,
133+ PutNoContent, PutNonAuthoritative,
134+ ReflectMethod (reflectMethod), StdMethod (..), Verb)
135+import Servant.API.WithNamedContext
136+ (WithNamedContext)
137+import Servant.Utils.Links
138+ (HasLink (..), IsElem, IsElem', Link, URI (..), safeLink)
139+import Web.HttpApiData
140+ (FromHttpApiData (..), ToHttpApiData (..))
servant/src/Servant/API/Alternative.hs+5−3
@@ -1,14 +1,16 @@
11{-# LANGUAGE CPP #-}
22{-# LANGUAGE DeriveDataTypeable #-}
3−{-# LANGUAGE DeriveFunctor #-}
43{-# LANGUAGE DeriveFoldable #-}
4+{-# LANGUAGE DeriveFunctor #-}
55{-# LANGUAGE DeriveTraversable #-}
66{-# LANGUAGE TypeOperators #-}
77{-# OPTIONS_HADDOCK not-home #-}
88module Servant.API.Alternative ((:<|>)(..)) where
99
10−import Data.Semigroup (Semigroup (..))
11−import Data.Typeable (Typeable)
10+import Data.Semigroup
11+ (Semigroup (..))
12+import Data.Typeable
13+ (Typeable)
1214import Prelude ()
1315import Prelude.Compat
1416
servant/src/Servant/API/BasicAuth.hs+9−6
@@ -1,13 +1,16 @@
1−{-# LANGUAGE DataKinds #-}
1+{-# LANGUAGE DataKinds #-}
22{-# LANGUAGE DeriveDataTypeable #-}
3−{-# LANGUAGE KindSignatures #-}
4−{-# LANGUAGE PolyKinds #-}
3+{-# LANGUAGE KindSignatures #-}
4+{-# LANGUAGE PolyKinds #-}
55
66module Servant.API.BasicAuth where
77
8−import Data.ByteString (ByteString)
9−import Data.Typeable (Typeable)
10−import GHC.TypeLits (Symbol)
8+import Data.ByteString
9+ (ByteString)
10+import Data.Typeable
11+ (Typeable)
12+import GHC.TypeLits
13+ (Symbol)
1114
1215
1316-- | 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 @@
44{-# OPTIONS_HADDOCK not-home #-}
55module Servant.API.Capture (Capture, Capture', CaptureAll) where
66
7−import Data.Typeable (Typeable)
8−import GHC.TypeLits (Symbol)
7+import Data.Typeable
8+ (Typeable)
9+import GHC.TypeLits
10+ (Symbol)
911-- | Capture a value from the request path under a certain type @a@.
1012--
1113-- Example:
servant/src/Servant/API/ContentTypes.hs+21−15
@@ -71,32 +71,38 @@ module Servant.API.ContentTypes
7171 , canHandleAcceptH
7272 ) where
7373
74−import Control.Arrow (left)
74+import Control.Arrow
75+ (left)
7576import Control.Monad.Compat
76−import Data.Aeson (FromJSON(..), ToJSON(..), encode)
77−import Data.Aeson.Parser (value)
78−import Data.Aeson.Types (parseEither)
79−import Data.Attoparsec.ByteString.Char8 (endOfInput, parseOnly,
80− skipSpace, (<?>))
77+import Data.Aeson
78+ (FromJSON (..), ToJSON (..), encode)
79+import Data.Aeson.Parser
80+ (value)
81+import Data.Aeson.Types
82+ (parseEither)
83+import Data.Attoparsec.ByteString.Char8
84+ (endOfInput, parseOnly, skipSpace, (<?>))
8185import qualified Data.ByteString as BS
82−import Data.ByteString.Lazy (ByteString, fromStrict,
83− toStrict)
86+import Data.ByteString.Lazy
87+ (ByteString, fromStrict, toStrict)
8488import qualified Data.ByteString.Lazy.Char8 as BC
8589import qualified Data.List.NonEmpty as NE
86−import Data.Maybe (isJust)
87−import Data.String.Conversions (cs)
90+import Data.Maybe
91+ (isJust)
92+import Data.String.Conversions
93+ (cs)
8894import qualified Data.Text as TextS
8995import qualified Data.Text.Encoding as TextS
9096import qualified Data.Text.Lazy as TextL
9197import qualified Data.Text.Lazy.Encoding as TextL
9298import Data.Typeable
93−import GHC.Generics (Generic)
99+import GHC.Generics
100+ (Generic)
94101import qualified Network.HTTP.Media as M
95−import Web.FormUrlEncoded (FromForm, ToForm,
96− urlEncodeAsForm,
97− urlDecodeAsForm)
98−import Prelude ()
102+import Prelude ()
99103import Prelude.Compat
104+import Web.FormUrlEncoded
105+ (FromForm, ToForm, urlDecodeAsForm, urlEncodeAsForm)
100106
101107#if MIN_VERSION_base(4,9,0)
102108import qualified GHC.TypeLits as TL
servant/src/Servant/API/Description.hs+7−4
@@ -3,8 +3,8 @@
33{-# LANGUAGE FlexibleContexts #-}
44{-# LANGUAGE PolyKinds #-}
55{-# LANGUAGE ScopedTypeVariables #-}
6−{-# LANGUAGE TypeOperators #-}
76{-# LANGUAGE TypeFamilies #-}
7+{-# LANGUAGE TypeOperators #-}
88{-# OPTIONS_HADDOCK not-home #-}
99module Servant.API.Description (
1010 -- * Combinators
@@ -16,9 +16,12 @@ module Servant.API.Description (
1616 reflectDescription,
1717 ) where
1818
19−import Data.Typeable (Typeable)
20−import GHC.TypeLits (Symbol, KnownSymbol, symbolVal)
21−import Data.Proxy (Proxy (..))
19+import Data.Proxy
20+ (Proxy (..))
21+import Data.Typeable
22+ (Typeable)
23+import GHC.TypeLits
24+ (KnownSymbol, Symbol, symbolVal)
2225
2326-- | Add a short summary for (part of) API.
2427--
servant/src/Servant/API/Empty.hs+2−1
@@ -2,7 +2,8 @@
22{-# OPTIONS_HADDOCK not-home #-}
33module Servant.API.Empty(EmptyAPI(..)) where
44
5−import Data.Typeable (Typeable)
5+import Data.Typeable
6+ (Typeable)
67import Prelude ()
78import Prelude.Compat
89
servant/src/Servant/API/Experimental/Auth.hs+5−4
@@ -1,10 +1,11 @@
1−{-# LANGUAGE DataKinds #-}
1+{-# LANGUAGE DataKinds #-}
22{-# LANGUAGE DeriveDataTypeable #-}
3−{-# LANGUAGE KindSignatures #-}
4−{-# LANGUAGE PolyKinds #-}
3+{-# LANGUAGE KindSignatures #-}
4+{-# LANGUAGE PolyKinds #-}
55module Servant.API.Experimental.Auth where
66
7−import Data.Typeable (Typeable)
7+import Data.Typeable
8+ (Typeable)
89
910-- | A generalized Authentication combinator. Use this if you have a
1011-- non-standard authentication technique.
servant/src/Servant/API/Header.hs+4−2
@@ -6,8 +6,10 @@ module Servant.API.Header (
66 Header, Header',
77 ) where
88
9−import Data.Typeable (Typeable)
10−import GHC.TypeLits (Symbol)
9+import Data.Typeable
10+ (Typeable)
11+import GHC.TypeLits
12+ (Symbol)
1113import Servant.API.Modifiers
1214
1315-- | 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
33 HttpVersion(..)
44 ) where
55
6−import Network.HTTP.Types (HttpVersion (..))
6+import Network.HTTP.Types
7+ (HttpVersion (..))
78
89-- $httpversion
910--
servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs+1−2
@@ -1,4 +1,4 @@
1−{-# LANGUAGE DataKinds #-}
1+{-# LANGUAGE DataKinds #-}
22{-# LANGUAGE TypeOperators #-}
33
44-- | This is a module containing an API with all `Servant.API` combinators. It
@@ -7,7 +7,6 @@
77module Servant.API.Internal.Test.ComprehensiveAPI where
88
99import Data.Proxy
10−
1110import Servant.API
1211
1312type GET = Get '[JSON] NoContent
servant/src/Servant/API/IsSecure.hs+4−2
@@ -1,12 +1,14 @@
11{-# LANGUAGE DeriveDataTypeable #-}
2−{-# LANGUAGE DeriveGeneric #-}
2+{-# LANGUAGE DeriveGeneric #-}
33module Servant.API.IsSecure
44 ( -- $issecure
55 IsSecure(..)
66 ) where
77
88import Data.Typeable
9−import GHC.Generics (Generic)
9+ (Typeable)
10+import GHC.Generics
11+ (Generic)
1012
1113-- | Was this request made over an SSL connection?
1214--
servant/src/Servant/API/Modifiers.hs+9−5
@@ -1,6 +1,6 @@
11{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE KindSignatures #-}
32{-# LANGUAGE FlexibleContexts #-}
3+{-# LANGUAGE KindSignatures #-}
44{-# LANGUAGE ScopedTypeVariables #-}
55{-# LANGUAGE TypeFamilies #-}
66{-# LANGUAGE TypeOperators #-}
@@ -19,10 +19,14 @@ module Servant.API.Modifiers (
1919 unfoldRequestArgument,
2020 ) where
2121
22−import Data.Proxy (Proxy (..))
23−import Data.Singletons.Bool (SBool (..), SBoolI (..))
24−import Data.Text (Text)
25−import Data.Type.Bool (If)
22+import Data.Proxy
23+ (Proxy (..))
24+import Data.Singletons.Bool
25+ (SBool (..), SBoolI (..))
26+import Data.Text
27+ (Text)
28+import Data.Type.Bool
29+ (If)
2630
2731-- | Required argument. Not wrapped.
2832data Required
servant/src/Servant/API/QueryParam.hs+5−3
@@ -1,12 +1,14 @@
11{-# LANGUAGE DataKinds #-}
22{-# LANGUAGE DeriveDataTypeable #-}
3−{-# LANGUAGE TypeOperators #-}
43{-# LANGUAGE PolyKinds #-}
4+{-# LANGUAGE TypeOperators #-}
55{-# OPTIONS_HADDOCK not-home #-}
66module Servant.API.QueryParam (QueryFlag, QueryParam, QueryParam', QueryParams) where
77
8−import Data.Typeable (Typeable)
9−import GHC.TypeLits (Symbol)
8+import Data.Typeable
9+ (Typeable)
10+import GHC.TypeLits
11+ (Symbol)
1012import Servant.API.Modifiers
1113
1214-- | Lookup the value associated to the @sym@ query string parameter
servant/src/Servant/API/Raw.hs+3−1
@@ -2,7 +2,9 @@
22{-# OPTIONS_HADDOCK not-home #-}
33module Servant.API.Raw where
44
5−import Data.Typeable (Typeable)
5+import Data.Typeable
6+ (Typeable)
7+
68-- | Endpoint for plugging in your own Wai 'Application's.
79--
810-- 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
55 ) where
66
77import Data.Typeable
8+ (Typeable)
89
910-- | Provides access to the host or IP address
1011-- from which the HTTP request was sent.
servant/src/Servant/API/ReqBody.hs+4−3
@@ -6,8 +6,9 @@ module Servant.API.ReqBody (
66 ReqBody, ReqBody',
77 ) where
88
9−import Data.Typeable (Typeable)
10−import Servant.API.Modifiers
9+import Data.Typeable
10+ (Typeable)
11+import Servant.API.Modifiers
1112
1213-- | Extract the request body as a value of type @a@.
1314--
@@ -17,7 +18,7 @@ import Servant.API.Modifiers
1718-- >>> type MyApi = "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book
1819type ReqBody = ReqBody' '[Required, Strict]
1920
20−-- |
21+-- |
2122--
2223-- /Note:/ 'ReqBody'' is always 'Required'.
2324data ReqBody' (mods :: [*]) (contentTypes :: [*]) (a :: *)
servant/src/Servant/API/ResponseHeaders.hs+14−10
@@ -34,18 +34,22 @@ module Servant.API.ResponseHeaders
3434 , HList(..)
3535 ) where
3636
37−import Data.ByteString.Char8 as BS (ByteString, pack, unlines, init)
38−import Data.Typeable (Typeable)
39−import Web.HttpApiData (ToHttpApiData, toHeader,
40− FromHttpApiData, parseHeader)
41−import qualified Data.CaseInsensitive as CI
37+import Data.ByteString.Char8 as BS
38+ (ByteString, init, pack, unlines)
39+import qualified Data.CaseInsensitive as CI
4240import Data.Proxy
43−import GHC.TypeLits (KnownSymbol, Symbol, symbolVal)
44−import qualified Network.HTTP.Types.Header as HTTP
45−
46−import Servant.API.Header (Header)
47−import Prelude ()
41+import Data.Typeable
42+ (Typeable)
43+import GHC.TypeLits
44+ (KnownSymbol, Symbol, symbolVal)
45+import qualified Network.HTTP.Types.Header as HTTP
46+import Web.HttpApiData
47+ (FromHttpApiData, ToHttpApiData, parseHeader, toHeader)
48+
49+import Prelude ()
4850import Prelude.Compat
51+import Servant.API.Header
52+ (Header)
4953
5054-- | Response Header objects. You should never need to construct one directly.
5155-- Instead, use 'addOptionalHeader'.
servant/src/Servant/API/Stream.hs+27−19
@@ -1,26 +1,34 @@
1−{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE DeriveDataTypeable #-}
3−{-# LANGUAGE DeriveGeneric #-}
4−{-# LANGUAGE FlexibleInstances #-}
5−{-# LANGUAGE KindSignatures #-}
6−{-# LANGUAGE MultiParamTypeClasses #-}
7−{-# LANGUAGE OverloadedStrings #-}
8−{-# LANGUAGE PolyKinds #-}
9−{-# LANGUAGE RankNTypes #-}
10−{-# LANGUAGE TupleSections #-}
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE DeriveDataTypeable #-}
3+{-# LANGUAGE DeriveGeneric #-}
4+{-# LANGUAGE FlexibleInstances #-}
5+{-# LANGUAGE KindSignatures #-}
6+{-# LANGUAGE MultiParamTypeClasses #-}
7+{-# LANGUAGE OverloadedStrings #-}
8+{-# LANGUAGE PolyKinds #-}
9+{-# LANGUAGE RankNTypes #-}
10+{-# LANGUAGE TupleSections #-}
1111{-# OPTIONS_HADDOCK not-home #-}
1212
1313module Servant.API.Stream where
1414
15−import Data.ByteString.Lazy (ByteString, empty)
16−import qualified Data.ByteString.Lazy.Char8 as LB
17−import Data.Monoid ((<>))
18−import Data.Proxy (Proxy)
19−import Data.Typeable (Typeable)
20−import GHC.Generics (Generic)
21−import Text.Read (readMaybe)
22−import Control.Arrow (first)
23−import Network.HTTP.Types.Method (StdMethod (..))
15+import Control.Arrow
16+ (first)
17+import Data.ByteString.Lazy
18+ (ByteString, empty)
19+import qualified Data.ByteString.Lazy.Char8 as LB
20+import Data.Monoid
21+ ((<>))
22+import Data.Proxy
23+ (Proxy)
24+import Data.Typeable
25+ (Typeable)
26+import GHC.Generics
27+ (Generic)
28+import Network.HTTP.Types.Method
29+ (StdMethod (..))
30+import Text.Read
31+ (readMaybe)
2432
2533-- | 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.
2634data Stream (method :: k1) (framing :: *) (contentType :: *) (a :: *)
servant/src/Servant/API/Sub.hs+2−1
@@ -4,7 +4,8 @@
44{-# OPTIONS_HADDOCK not-home #-}
55module Servant.API.Sub ((:>)) where
66
7−import Data.Typeable (Typeable)
7+import Data.Typeable
8+ (Typeable)
89
910-- | The contained API (second argument) can be found under @("/" ++ path)@
1011-- (path being the first argument).
servant/src/Servant/API/TypeLevel.hs+18−9
@@ -47,16 +47,25 @@ module Servant.API.TypeLevel (
4747 ) where
4848
4949
50−import GHC.Exts (Constraint)
51−import Servant.API.Alternative (type (:<|>))
52−import Servant.API.Capture (Capture, CaptureAll)
53−import Servant.API.Header (Header)
54−import Servant.API.QueryParam (QueryFlag, QueryParam, QueryParams)
55−import Servant.API.ReqBody (ReqBody)
56−import Servant.API.Sub (type (:>))
57−import Servant.API.Verbs (Verb)
50+import GHC.Exts
51+ (Constraint)
52+import Servant.API.Alternative
53+ (type (:<|>))
54+import Servant.API.Capture
55+ (Capture, CaptureAll)
56+import Servant.API.Header
57+ (Header)
58+import Servant.API.QueryParam
59+ (QueryFlag, QueryParam, QueryParams)
60+import Servant.API.ReqBody
61+ (ReqBody)
62+import Servant.API.Sub
63+ (type (:>))
64+import Servant.API.Verbs
65+ (Verb)
5866#if MIN_VERSION_base(4,9,0)
59−import GHC.TypeLits (TypeError, ErrorMessage(..))
67+import GHC.TypeLits
68+ (ErrorMessage (..), TypeError)
6069#endif
6170
6271
servant/src/Servant/API/Vault.hs+2−1
@@ -3,7 +3,8 @@ module Servant.API.Vault
33 Vault
44 ) where
55
6−import Data.Vault.Lazy (Vault)
6+import Data.Vault.Lazy
7+ (Vault)
78
89-- $vault
910--
servant/src/Servant/API/Verbs.hs+12−9
@@ -8,15 +8,18 @@ module Servant.API.Verbs
88 , StdMethod(GET, POST, HEAD, PUT, DELETE, TRACE, CONNECT, OPTIONS, PATCH)
99 ) where
1010
11−import Data.Typeable (Typeable)
12−import Data.Proxy (Proxy)
13−import GHC.Generics (Generic)
14−import GHC.TypeLits (Nat)
15−import Network.HTTP.Types.Method (Method, StdMethod (..),
16− methodDelete, methodGet, methodHead,
17− methodPatch, methodPost, methodPut,
18− methodTrace, methodConnect,
19− methodOptions)
11+import Data.Proxy
12+ (Proxy)
13+import Data.Typeable
14+ (Typeable)
15+import GHC.Generics
16+ (Generic)
17+import GHC.TypeLits
18+ (Nat)
19+import Network.HTTP.Types.Method
20+ (Method, StdMethod (..), methodConnect, methodDelete,
21+ methodGet, methodHead, methodOptions, methodPatch, methodPost,
22+ methodPut, methodTrace)
2023
2124-- | @Verb@ is a general type for representing HTTP verbs (a.k.a. methods). For
2225-- 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 #-}
22{-# LANGUAGE KindSignatures #-}
33
44module Servant.API.WithNamedContext where
55
6−import GHC.TypeLits
6+import GHC.TypeLits
77
88-- | 'WithNamedContext' names a specific tagged context to use for the
99-- 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
1313 (:~>)(..),
1414 ) where
1515
16−import Control.Natural
1716import Control.Monad.Identity
1817import Control.Monad.Morph
1918import Control.Monad.Reader
@@ -21,8 +20,10 @@ import qualified Control.Monad.State.Lazy as LState
2120import qualified Control.Monad.State.Strict as SState
2221import qualified Control.Monad.Writer.Lazy as LWriter
2322import qualified Control.Monad.Writer.Strict as SWriter
24−import Data.Tagged (Tagged, retag)
25−import Prelude ()
23+import Control.Natural
24+import Data.Tagged
25+ (Tagged, retag)
26+import Prelude ()
2627import Prelude.Compat
2728import Servant.API
2829
servant/src/Servant/Utils/Links.hs+55−30
@@ -101,38 +101,63 @@ module Servant.Utils.Links (
101101) where
102102
103103import Data.List
104−import Data.Monoid.Compat ( (<>) )
105−import Data.Proxy ( Proxy(..) )
106−import Data.Singletons.Bool ( SBool (..), SBoolI (..) )
107−import qualified Data.Text as Text
108−import qualified Data.Text.Encoding as TE
109−import Data.Type.Bool (If)
110−import GHC.TypeLits ( KnownSymbol, symbolVal )
111−import Network.URI ( URI(..), escapeURIString, isUnreserved )
112−import Prelude ()
104+import Data.Monoid.Compat
105+ ((<>))
106+import Data.Proxy
107+ (Proxy (..))
108+import Data.Singletons.Bool
109+ (SBool (..), SBoolI (..))
110+import qualified Data.Text as Text
111+import qualified Data.Text.Encoding as TE
112+import Data.Type.Bool
113+ (If)
114+import GHC.TypeLits
115+ (KnownSymbol, symbolVal)
116+import Network.URI
117+ (URI (..), escapeURIString, isUnreserved)
118+import Prelude ()
113119import Prelude.Compat
114120
115−import Web.HttpApiData
116−import Servant.API.Alternative ( (:<|>)((:<|>)) )
117−import Servant.API.BasicAuth ( BasicAuth )
118−import Servant.API.Capture ( Capture', CaptureAll )
119−import Servant.API.ReqBody ( ReqBody' )
120−import Servant.API.QueryParam ( QueryParam', QueryParams, QueryFlag )
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 (..))
126−import Servant.API.Verbs ( Verb )
127−import Servant.API.Sub ( type (:>) )
128−import Servant.API.Raw ( Raw )
129−import Servant.API.Stream ( Stream )
130−import Servant.API.TypeLevel
131−import Servant.API.Modifiers (FoldRequired)
132−import Servant.API.Description (Description, Summary)
133−import Servant.API.Vault (Vault)
134−import Servant.API.WithNamedContext (WithNamedContext)
135−import Servant.API.Experimental.Auth ( AuthProtect )
121+import Servant.API.Alternative
122+ ((:<|>) ((:<|>)))
123+import Servant.API.BasicAuth
124+ (BasicAuth)
125+import Servant.API.Capture
126+ (Capture', CaptureAll)
127+import Servant.API.Description
128+ (Description, Summary)
129+import Servant.API.Empty
130+ (EmptyAPI (..))
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)
151+import Servant.API.Sub
152+ (type (:>))
153+import Servant.API.TypeLevel
154+import Servant.API.Vault
155+ (Vault)
156+import Servant.API.Verbs
157+ (Verb)
158+import Servant.API.WithNamedContext
159+ (WithNamedContext)
160+import Web.HttpApiData
136161
137162-- | A safe link datatype.
138163-- The only way of constructing a 'Link' is using 'safeLink', which means any