Skip to content

Commit 6d1ae0d

Browse files
authored
Merge pull request #680 from phadej/stylish-haskell
Update .stylish-haskell
2 parents bcca635 + 8058891 commit 6d1ae0d

27 files changed

+407
-206
lines changed

.stylish-haskell.yaml

Lines changed: 118 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
68168
columns: 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.
75187
language_extensions:
76-
- TemplateHaskell
77-
- QuasiQuotes
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:

0 commit comments

Comments
 (0)