You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

287 lines
10 KiB

  1. # stylish-haskell configuration file
  2. # ==================================
  3. # The stylish-haskell tool is mainly configured by specifying steps. These steps
  4. # are a list, so they have an order, and one specific step may appear more than
  5. # once (if needed). Each file is processed by these steps in the given order.
  6. steps:
  7. # Convert some ASCII sequences to their Unicode equivalents. This is disabled
  8. # by default.
  9. # - unicode_syntax:
  10. # # In order to make this work, we also need to insert the UnicodeSyntax
  11. # # language pragma. If this flag is set to true, we insert it when it's
  12. # # not already present. You may want to disable it if you configure
  13. # # language extensions using some other method than pragmas. Default:
  14. # # true.
  15. # add_language_pragma: true
  16. # Format record definitions. This is disabled by default.
  17. #
  18. # You can control the layout of record fields. The only rules that can't be configured
  19. # are these:
  20. #
  21. # - "|" is always aligned with "="
  22. # - "," in fields is always aligned with "{"
  23. # - "}" is likewise always aligned with "{"
  24. #
  25. # - records:
  26. # # How to format equals sign between type constructor and data constructor.
  27. # # Possible values:
  28. # # - "same_line" -- leave "=" AND data constructor on the same line as the type constructor.
  29. # # - "indent N" -- insert a new line and N spaces from the beginning of the next line.
  30. # equals: "indent 2"
  31. #
  32. # # How to format first field of each record constructor.
  33. # # Possible values:
  34. # # - "same_line" -- "{" and first field goes on the same line as the data constructor.
  35. # # - "indent N" -- insert a new line and N spaces from the beginning of the data constructor
  36. # first_field: "indent 2"
  37. #
  38. # # How many spaces to insert between the column with "," and the beginning of the comment in the next line.
  39. # field_comment: 2
  40. #
  41. # # How many spaces to insert before "deriving" clause. Deriving clauses are always on separate lines.
  42. # deriving: 2
  43. # Align the right hand side of some elements. This is quite conservative
  44. # and only applies to statements where each element occupies a single
  45. # line. All default to true.
  46. - simple_align:
  47. cases: true
  48. top_level_patterns: true
  49. records: true
  50. # Import cleanup
  51. - imports:
  52. # There are different ways we can align names and lists.
  53. #
  54. # - global: Align the import names and import list throughout the entire
  55. # file.
  56. #
  57. # - file: Like global, but don't add padding when there are no qualified
  58. # imports in the file.
  59. #
  60. # - group: Only align the imports per group (a group is formed by adjacent
  61. # import lines).
  62. #
  63. # - none: Do not perform any alignment.
  64. #
  65. # Default: global.
  66. align: global
  67. # The following options affect only import list alignment.
  68. #
  69. # List align has following options:
  70. #
  71. # - after_alias: Import list is aligned with end of import including
  72. # 'as' and 'hiding' keywords.
  73. #
  74. # > import qualified Data.List as List (concat, foldl, foldr, head,
  75. # > init, last, length)
  76. #
  77. # - with_alias: Import list is aligned with start of alias or hiding.
  78. #
  79. # > import qualified Data.List as List (concat, foldl, foldr, head,
  80. # > init, last, length)
  81. #
  82. # - with_module_name: Import list is aligned `list_padding` spaces after
  83. # the module name.
  84. #
  85. # > import qualified Data.List as List (concat, foldl, foldr, head,
  86. # init, last, length)
  87. #
  88. # This is mainly intended for use with `pad_module_names: false`.
  89. #
  90. # > import qualified Data.List as List (concat, foldl, foldr, head,
  91. # init, last, length, scanl, scanr, take, drop,
  92. # sort, nub)
  93. #
  94. # - new_line: Import list starts always on new line.
  95. #
  96. # > import qualified Data.List as List
  97. # > (concat, foldl, foldr, head, init, last, length)
  98. #
  99. # Default: after_alias
  100. list_align: after_alias
  101. # Right-pad the module names to align imports in a group:
  102. #
  103. # - true: a little more readable
  104. #
  105. # > import qualified Data.List as List (concat, foldl, foldr,
  106. # > init, last, length)
  107. # > import qualified Data.List.Extra as List (concat, foldl, foldr,
  108. # > init, last, length)
  109. #
  110. # - false: diff-safe
  111. #
  112. # > import qualified Data.List as List (concat, foldl, foldr, init,
  113. # > last, length)
  114. # > import qualified Data.List.Extra as List (concat, foldl, foldr,
  115. # > init, last, length)
  116. #
  117. # Default: true
  118. pad_module_names: true
  119. # Long list align style takes effect when import is too long. This is
  120. # determined by 'columns' setting.
  121. #
  122. # - inline: This option will put as much specs on same line as possible.
  123. #
  124. # - new_line: Import list will start on new line.
  125. #
  126. # - new_line_multiline: Import list will start on new line when it's
  127. # short enough to fit to single line. Otherwise it'll be multiline.
  128. #
  129. # - multiline: One line per import list entry.
  130. # Type with constructor list acts like single import.
  131. #
  132. # > import qualified Data.Map as M
  133. # > ( empty
  134. # > , singleton
  135. # > , ...
  136. # > , delete
  137. # > )
  138. #
  139. # Default: inline
  140. long_list_align: inline
  141. # Align empty list (importing instances)
  142. #
  143. # Empty list align has following options
  144. #
  145. # - inherit: inherit list_align setting
  146. #
  147. # - right_after: () is right after the module name:
  148. #
  149. # > import Vector.Instances ()
  150. #
  151. # Default: inherit
  152. empty_list_align: inherit
  153. # List padding determines indentation of import list on lines after import.
  154. # This option affects 'long_list_align'.
  155. #
  156. # - <integer>: constant value
  157. #
  158. # - module_name: align under start of module name.
  159. # Useful for 'file' and 'group' align settings.
  160. #
  161. # Default: 4
  162. list_padding: 4
  163. # Separate lists option affects formatting of import list for type
  164. # or class. The only difference is single space between type and list
  165. # of constructors, selectors and class functions.
  166. #
  167. # - true: There is single space between Foldable type and list of it's
  168. # functions.
  169. #
  170. # > import Data.Foldable (Foldable (fold, foldl, foldMap))
  171. #
  172. # - false: There is no space between Foldable type and list of it's
  173. # functions.
  174. #
  175. # > import Data.Foldable (Foldable(fold, foldl, foldMap))
  176. #
  177. # Default: true
  178. separate_lists: true
  179. # Space surround option affects formatting of import lists on a single
  180. # line. The only difference is single space after the initial
  181. # parenthesis and a single space before the terminal parenthesis.
  182. #
  183. # - true: There is single space associated with the enclosing
  184. # parenthesis.
  185. #
  186. # > import Data.Foo ( foo )
  187. #
  188. # - false: There is no space associated with the enclosing parenthesis
  189. #
  190. # > import Data.Foo (foo)
  191. #
  192. # Default: false
  193. space_surround: false
  194. # Language pragmas
  195. - language_pragmas:
  196. # We can generate different styles of language pragma lists.
  197. #
  198. # - vertical: Vertical-spaced language pragmas, one per line.
  199. #
  200. # - compact: A more compact style.
  201. #
  202. # - compact_line: Similar to compact, but wrap each line with
  203. # `{-#LANGUAGE #-}'.
  204. #
  205. # Default: vertical.
  206. style: vertical
  207. # Align affects alignment of closing pragma brackets.
  208. #
  209. # - true: Brackets are aligned in same column.
  210. #
  211. # - false: Brackets are not aligned together. There is only one space
  212. # between actual import and closing bracket.
  213. #
  214. # Default: true
  215. align: true
  216. # stylish-haskell can detect redundancy of some language pragmas. If this
  217. # is set to true, it will remove those redundant pragmas. Default: true.
  218. remove_redundant: true
  219. # Language prefix to be used for pragma declaration, this allows you to
  220. # use other options non case-sensitive like "language" or "Language".
  221. # If a non correct String is provided, it will default to: LANGUAGE.
  222. language_prefix: LANGUAGE
  223. # Replace tabs by spaces. This is disabled by default.
  224. # - tabs:
  225. # # Number of spaces to use for each tab. Default: 8, as specified by the
  226. # # Haskell report.
  227. # spaces: 8
  228. # Remove trailing whitespace
  229. - trailing_whitespace: {}
  230. # Squash multiple spaces between the left and right hand sides of some
  231. # elements into single spaces. Basically, this undoes the effect of
  232. # simple_align but is a bit less conservative.
  233. # - squash: {}
  234. # A common setting is the number of columns (parts of) code will be wrapped
  235. # to. Different steps take this into account.
  236. #
  237. # Set this to null to disable all line wrapping.
  238. #
  239. # Default: 80.
  240. columns: 80
  241. # By default, line endings are converted according to the OS. You can override
  242. # preferred format here.
  243. #
  244. # - native: Native newline format. CRLF on Windows, LF on other OSes.
  245. #
  246. # - lf: Convert to LF ("\n").
  247. #
  248. # - crlf: Convert to CRLF ("\r\n").
  249. #
  250. # Default: native.
  251. newline: native
  252. # Sometimes, language extensions are specified in a cabal file or from the
  253. # command line instead of using language pragmas in the file. stylish-haskell
  254. # needs to be aware of these, so it can parse the file correctly.
  255. #
  256. # No language extensions are enabled by default.
  257. # language_extensions:
  258. # - TemplateHaskell
  259. # - QuasiQuotes
  260. # Attempt to find the cabal file in ancestors of the current directory, and
  261. # parse options (currently only language extensions) from that.
  262. #
  263. # Default: true
  264. cabal: true