|
| 1 | +# Stylish-haskell configuration file used for cardano-sl by Serokell. |
| 2 | +# It's based on default config provided by `stylish-haskell --defaults` but has some changes |
| 3 | +# ================================== |
| 4 | + |
| 5 | +# The stylish-haskell tool is mainly configured by specifying steps. These steps |
| 6 | +# are a list, so they have an order, and one specific step may appear more than |
| 7 | +# once (if needed). Each file is processed by these steps in the given order. |
| 8 | +steps: |
| 9 | + # Convert some ASCII sequences to their Unicode equivalents. This is disabled |
| 10 | + # by default. |
| 11 | + # - unicode_syntax: |
| 12 | + # # In order to make this work, we also need to insert the UnicodeSyntax |
| 13 | + # # language pragma. If this flag is set to true, we insert it when it's |
| 14 | + # # not already present. You may want to disable it if you configure |
| 15 | + # # language extensions using some other method than pragmas. Default: |
| 16 | + # # true. |
| 17 | + # add_language_pragma: true |
| 18 | + |
| 19 | + # Align the right hand side of some elements. This is quite conservative |
| 20 | + # and only applies to statements where each element occupies a single |
| 21 | + # line. |
| 22 | + - simple_align: |
| 23 | + cases: true |
| 24 | + top_level_patterns: true |
| 25 | + records: true |
| 26 | + |
| 27 | + # Import cleanup |
| 28 | + - imports: |
| 29 | + # There are different ways we can align names and lists. |
| 30 | + # |
| 31 | + # - global: Align the import names and import list throughout the entire |
| 32 | + # file. |
| 33 | + # |
| 34 | + # - file: Like global, but don't add padding when there are no qualified |
| 35 | + # imports in the file. |
| 36 | + # |
| 37 | + # - group: Only align the imports per group (a group is formed by adjacent |
| 38 | + # import lines). |
| 39 | + # |
| 40 | + # - none: Do not perform any alignment. |
| 41 | + # |
| 42 | + # Default: global. |
| 43 | + align: global |
| 44 | + |
| 45 | + # The following options affect only import list alignment. |
| 46 | + # |
| 47 | + # List align has following options: |
| 48 | + # |
| 49 | + # - after_alias: Import list is aligned with end of import including |
| 50 | + # 'as' and 'hiding' keywords. |
| 51 | + # |
| 52 | + # > import qualified Data.List as List (concat, foldl, foldr, head, |
| 53 | + # > init, last, length) |
| 54 | + # |
| 55 | + # - with_alias: Import list is aligned with start of alias or hiding. |
| 56 | + # |
| 57 | + # > import qualified Data.List as List (concat, foldl, foldr, head, |
| 58 | + # > init, last, length) |
| 59 | + # |
| 60 | + # - new_line: Import list starts always on new line. |
| 61 | + # |
| 62 | + # > import qualified Data.List as List |
| 63 | + # > (concat, foldl, foldr, head, init, last, length) |
| 64 | + # |
| 65 | + # Default: after_alias |
| 66 | + list_align: after_alias |
| 67 | + |
| 68 | + # Right-pad the module names to align imports in a group: |
| 69 | + # |
| 70 | + # - true: a little more readable |
| 71 | + # |
| 72 | + # > import qualified Data.List as List (concat, foldl, foldr, |
| 73 | + # > init, last, length) |
| 74 | + # > import qualified Data.List.Extra as List (concat, foldl, foldr, |
| 75 | + # > init, last, length) |
| 76 | + # |
| 77 | + # - false: diff-safe |
| 78 | + # |
| 79 | + # > import qualified Data.List as List (concat, foldl, foldr, init, |
| 80 | + # > last, length) |
| 81 | + # > import qualified Data.List.Extra as List (concat, foldl, foldr, |
| 82 | + # > init, last, length) |
| 83 | + # |
| 84 | + # Default: true |
| 85 | + |
| 86 | + # Note: we intentionally disable it to make diffs less verbose and avoid |
| 87 | + # merge conflicts in some cases. |
| 88 | + pad_module_names: false |
| 89 | + |
| 90 | + # Long list align style takes effect when import is too long. This is |
| 91 | + # determined by 'columns' setting. |
| 92 | + # |
| 93 | + # - inline: This option will put as much specs on same line as possible. |
| 94 | + # |
| 95 | + # - new_line: Import list will start on new line. |
| 96 | + # |
| 97 | + # - new_line_multiline: Import list will start on new line when it's |
| 98 | + # short enough to fit to single line. Otherwise it'll be multiline. |
| 99 | + # |
| 100 | + # - multiline: One line per import list entry. |
| 101 | + # Type with constructor list acts like single import. |
| 102 | + # |
| 103 | + # > import qualified Data.Map as M |
| 104 | + # > ( empty |
| 105 | + # > , singleton |
| 106 | + # > , ... |
| 107 | + # > , delete |
| 108 | + # > ) |
| 109 | + # |
| 110 | + # Default: inline |
| 111 | + long_list_align: inline |
| 112 | + |
| 113 | + # Align empty list (importing instances) |
| 114 | + # |
| 115 | + # Empty list align has following options |
| 116 | + # |
| 117 | + # - inherit: inherit list_align setting |
| 118 | + # |
| 119 | + # - right_after: () is right after the module name: |
| 120 | + # |
| 121 | + # > import Vector.Instances () |
| 122 | + # |
| 123 | + # Default: inherit |
| 124 | + empty_list_align: inherit |
| 125 | + |
| 126 | + # List padding determines indentation of import list on lines after import. |
| 127 | + # This option affects 'long_list_align'. |
| 128 | + # |
| 129 | + # - <integer>: constant value |
| 130 | + # |
| 131 | + # - module_name: align under start of module name. |
| 132 | + # Useful for 'file' and 'group' align settings. |
| 133 | + list_padding: 4 |
| 134 | + |
| 135 | + # Separate lists option affects formatting of import list for type |
| 136 | + # or class. The only difference is single space between type and list |
| 137 | + # of constructors, selectors and class functions. |
| 138 | + # |
| 139 | + # - true: There is single space between Foldable type and list of it's |
| 140 | + # functions. |
| 141 | + # |
| 142 | + # > import Data.Foldable (Foldable (fold, foldl, foldMap)) |
| 143 | + # |
| 144 | + # - false: There is no space between Foldable type and list of it's |
| 145 | + # functions. |
| 146 | + # |
| 147 | + # > import Data.Foldable (Foldable(fold, foldl, foldMap)) |
| 148 | + # |
| 149 | + # Default: true |
| 150 | + separate_lists: true |
| 151 | + |
| 152 | + # Space surround option affects formatting of import lists on a single |
| 153 | + # line. The only difference is single space after the initial |
| 154 | + # parenthesis and a single space before the terminal parenthesis. |
| 155 | + # |
| 156 | + # - true: There is single space associated with the enclosing |
| 157 | + # parenthesis. |
| 158 | + # |
| 159 | + # > import Data.Foo ( foo ) |
| 160 | + # |
| 161 | + # - false: There is no space associated with the enclosing parenthesis |
| 162 | + # |
| 163 | + # > import Data.Foo (foo) |
| 164 | + # |
| 165 | + # Default: false |
| 166 | + space_surround: false |
| 167 | + |
| 168 | + # Language pragmas |
| 169 | + - language_pragmas: |
| 170 | + # We can generate different styles of language pragma lists. |
| 171 | + # |
| 172 | + # - vertical: Vertical-spaced language pragmas, one per line. |
| 173 | + # |
| 174 | + # - compact: A more compact style. |
| 175 | + # |
| 176 | + # - compact_line: Similar to compact, but wrap each line with |
| 177 | + # `{-#LANGUAGE #-}'. |
| 178 | + # |
| 179 | + # Default: vertical. |
| 180 | + style: vertical |
| 181 | + |
| 182 | + # stylish-haskell can detect redundancy of some language pragmas. If this |
| 183 | + # is set to true, it will remove those redundant pragmas. Default: true. |
| 184 | + remove_redundant: true |
| 185 | + |
| 186 | + # Replace tabs by spaces. This is disabled by default. |
| 187 | + # - tabs: |
| 188 | + # # Number of spaces to use for each tab. Default: 8, as specified by the |
| 189 | + # # Haskell report. |
| 190 | + # spaces: 8 |
| 191 | + |
| 192 | + # Remove trailing whitespace |
| 193 | + - trailing_whitespace: {} |
| 194 | + |
| 195 | +# A common setting is the number of columns (parts of) code will be wrapped |
| 196 | +# to. Different steps take this into account. Default: 80. |
| 197 | +# |
| 198 | +# Note: we tend to write code which fits into 80 characters, in some cases |
| 199 | +# 100 is acceptable. For imports we always permit 100 characters because it |
| 200 | +# decreases verbosity of diffs and makes merging easier. |
| 201 | +columns: 100 |
| 202 | + |
| 203 | +# By default, line endings are converted according to the OS. You can override |
| 204 | +# preferred format here. |
| 205 | +# |
| 206 | +# - native: Native newline format. CRLF on Windows, LF on other OSes. |
| 207 | +# |
| 208 | +# - lf: Convert to LF ("\n"). |
| 209 | +# |
| 210 | +# - crlf: Convert to CRLF ("\r\n"). |
| 211 | +# |
| 212 | +# Default: native. |
| 213 | +newline: native |
| 214 | + |
| 215 | +# These syntax-affecting language extensions are enabled so that |
| 216 | +# stylish-haskell wouldn't fail with parsing errors when processing files |
| 217 | +# in projects that have those extensions enabled in the .cabal file |
| 218 | +# rather than locally. |
| 219 | +# |
| 220 | +# To my best knowledge, no harm should result from enabling an extension |
| 221 | +# that isn't actually used in the file/project. —@neongreen |
| 222 | +language_extensions: |
| 223 | + - BangPatterns |
| 224 | + - ConstraintKinds |
| 225 | + - DataKinds |
| 226 | + - DefaultSignatures |
| 227 | + - DeriveDataTypeable |
| 228 | + - DeriveGeneric |
| 229 | + - FlexibleContexts |
| 230 | + - FlexibleInstances |
| 231 | + - FunctionalDependencies |
| 232 | + - GADTs |
| 233 | + - GeneralizedNewtypeDeriving |
| 234 | + - LambdaCase |
| 235 | + - MultiParamTypeClasses |
| 236 | + - MultiWayIf |
| 237 | + - NoImplicitPrelude |
| 238 | + - OverloadedStrings |
| 239 | + - PolyKinds |
| 240 | + - RecordWildCards |
| 241 | + - ScopedTypeVariables |
| 242 | + - StandaloneDeriving |
| 243 | + - TemplateHaskell |
| 244 | + - TupleSections |
| 245 | + - TypeApplications |
| 246 | + - TypeFamilies |
| 247 | + - ViewPatterns |
0 commit comments