/
Types.hs
93 lines (82 loc) · 2.34 KB
/
Types.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{-# LANGUAGE DeriveGeneric #-}
-- | This module defines PrinterOpts and related types
module Ormolu.Config.Types
( PrinterOpts (..),
CommaStyle (..),
FunctionArrowsStyle (..),
HaddockPrintStyle (..),
HaddockPrintStyleModule (..),
ImportExportStyle (..),
LetStyle (..),
InStyle (..),
Unicode (..),
)
where
import GHC.Generics (Generic)
-- | Options controlling formatting output.
data PrinterOpts f = PrinterOpts
{ -- | Number of spaces to use for indentation
poIndentation :: f Int,
-- | How to style arrows in type signatures
poFunctionArrows :: f FunctionArrowsStyle,
-- | Whether to place commas at start or end of lines
poCommaStyle :: f CommaStyle,
-- | Styling of import/export lists
poImportExportStyle :: f ImportExportStyle,
-- | Whether to indent `where` blocks
poIndentWheres :: f Bool,
-- | Leave space before opening record brace
poRecordBraceSpace :: f Bool,
-- | Number of newlines between top-level decls
poNewlinesBetweenDecls :: f Int,
-- | How to print doc comments
poHaddockStyle :: f HaddockPrintStyle,
-- | How to print the module docstring (defaults to poHaddockStyle)
poHaddockStyleModule :: f HaddockPrintStyleModule,
-- | Styling of let blocks
poLetStyle :: f LetStyle,
-- | How to align in keyword
poInStyle :: f InStyle,
-- | Output Unicode syntax
poUnicode :: f Unicode,
-- | Be less opinionated about spaces/newlines etc.
poRespectful :: f Bool
}
deriving (Generic)
data CommaStyle
= Leading
| Trailing
deriving (Eq, Show, Enum, Bounded)
data FunctionArrowsStyle
= TrailingArrows
| LeadingArrows
deriving (Eq, Show, Enum, Bounded)
data HaddockPrintStyle
= HaddockSingleLine
| HaddockMultiLine
| HaddockMultiLineCompact
deriving (Eq, Show, Enum, Bounded)
data HaddockPrintStyleModule
= PrintStyleInherit
| PrintStyleOverride HaddockPrintStyle
deriving (Eq, Show)
data ImportExportStyle
= ImportExportLeading
| ImportExportTrailing
| ImportExportDiffFriendly
deriving (Eq, Show, Enum, Bounded)
data LetStyle
= LetAuto
| LetInline
| LetNewline
| LetMixed
deriving (Eq, Show, Enum, Bounded)
data InStyle
= InLeftAlign
| InRightAlign
deriving (Eq, Show, Enum, Bounded)
data Unicode
= UnicodeDetect
| UnicodeAlways
| UnicodeNever
deriving (Eq, Show, Enum, Bounded)