Skip to content

Commit 8058891

Browse files
committed
Reformat servant
1 parent 74cf829 commit 8058891

27 files changed

+293
-204
lines changed

.stylish-haskell.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ newline: lf
184184
# needs to be aware of these, so it can parse the file correctly.
185185
#
186186
# No language extensions are enabled by default.
187-
# language_extensions:
188-
# - TemplateHaskell
189-
# - QuasiQuotes
187+
language_extensions:
188+
- FlexibleContexts
189+
- TemplateHaskell
190+
- QuasiQuotes

servant/src/Servant/API.hs

Lines changed: 67 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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 #-}
88
module 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)
1214
import Prelude ()
1315
import Prelude.Compat
1416

servant/src/Servant/API/BasicAuth.hs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

66
module 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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
{-# OPTIONS_HADDOCK not-home #-}
55
module 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

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,32 +71,38 @@ module Servant.API.ContentTypes
7171
, canHandleAcceptH
7272
) where
7373

74-
import Control.Arrow (left)
74+
import Control.Arrow
75+
(left)
7576
import 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, (<?>))
8185
import qualified Data.ByteString as BS
82-
import Data.ByteString.Lazy (ByteString, fromStrict,
83-
toStrict)
86+
import Data.ByteString.Lazy
87+
(ByteString, fromStrict, toStrict)
8488
import qualified Data.ByteString.Lazy.Char8 as BC
8589
import 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)
8894
import qualified Data.Text as TextS
8995
import qualified Data.Text.Encoding as TextS
9096
import qualified Data.Text.Lazy as TextL
9197
import qualified Data.Text.Lazy.Encoding as TextL
9298
import Data.Typeable
93-
import GHC.Generics (Generic)
99+
import GHC.Generics
100+
(Generic)
94101
import qualified Network.HTTP.Media as M
95-
import Web.FormUrlEncoded (FromForm, ToForm,
96-
urlEncodeAsForm,
97-
urlDecodeAsForm)
98-
import Prelude ()
102+
import Prelude ()
99103
import Prelude.Compat
104+
import Web.FormUrlEncoded
105+
(FromForm, ToForm, urlDecodeAsForm, urlEncodeAsForm)
100106

101107
#if MIN_VERSION_base(4,9,0)
102108
import qualified GHC.TypeLits as TL

servant/src/Servant/API/Description.hs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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 #-}
99
module 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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
{-# OPTIONS_HADDOCK not-home #-}
33
module Servant.API.Empty(EmptyAPI(..)) where
44

5-
import Data.Typeable (Typeable)
5+
import Data.Typeable
6+
(Typeable)
67
import Prelude ()
78
import Prelude.Compat
89

servant/src/Servant/API/Experimental/Auth.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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 #-}
55
module 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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
1113
import Servant.API.Modifiers
1214

1315
-- | Extract the given header's value as a value of type @a@.

0 commit comments

Comments
 (0)