Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Ormolu.Config
Description
Configuration options used by the tool.
Synopsis
- data Config region = Config {
- cfgDynOptions :: ![DynOption]
- cfgFixityOverrides :: !FixityOverrides
- cfgModuleReexports :: !ModuleReexports
- cfgDependencies :: !(Set PackageName)
- cfgUnsafe :: !Bool
- cfgDebug :: !Bool
- cfgCheckIdempotence :: !Bool
- cfgSourceType :: !SourceType
- cfgColorMode :: !ColorMode
- cfgRegion :: !region
- cfgPrinterOpts :: !PrinterOptsTotal
- data ColorMode
- data RegionIndices = RegionIndices {
- regionStartLine :: !(Maybe Int)
- regionEndLine :: !(Maybe Int)
- data RegionDeltas = RegionDeltas {}
- data SourceType
- defaultConfig :: Config RegionIndices
- overapproximatedDependencies :: Config region -> Set PackageName
- regionIndicesToDeltas :: Int -> RegionIndices -> RegionDeltas
- newtype DynOption = DynOption {}
- dynOptionToLocatedStr :: DynOption -> Located String
- data PrinterOpts f = PrinterOpts {
- poIndentation :: f Int
- poColumnLimit :: f ColumnLimit
- poFunctionArrows :: f FunctionArrowsStyle
- poCommaStyle :: f CommaStyle
- poImportExportStyle :: f ImportExportStyle
- poIndentWheres :: f Bool
- poRecordBraceSpace :: f Bool
- poNewlinesBetweenDecls :: f Int
- poHaddockStyle :: f HaddockPrintStyle
- poHaddockStyleModule :: f HaddockPrintStyleModule
- poLetStyle :: f LetStyle
- poInStyle :: f InStyle
- poSingleConstraintParens :: f SingleConstraintParens
- poUnicode :: f Unicode
- poRespectful :: f Bool
- type PrinterOptsPartial = PrinterOpts Maybe
- type PrinterOptsTotal = PrinterOpts Identity
- defaultPrinterOpts :: PrinterOpts Identity
- defaultPrinterOptsYaml :: String
- fillMissingPrinterOpts :: forall f. Applicative f => PrinterOpts Maybe -> PrinterOpts f -> PrinterOpts f
- resolvePrinterOpts :: [PrinterOptsPartial] -> PrinterOptsTotal
- data CommaStyle
- data FunctionArrowsStyle
- data HaddockPrintStyle
- data HaddockPrintStyleModule
- data ImportExportStyle
- data LetStyle
- data InStyle
- data Unicode
- data ColumnLimit
- parsePrinterOptsCLI :: Applicative f => (forall a. PrinterOptsFieldType a => String -> String -> String -> f (Maybe a)) -> f (PrinterOpts Maybe)
- parsePrinterOptType :: PrinterOptsFieldType a => String -> Either String a
- loadConfigFile :: FilePath -> IO ConfigFileLoadResult
- configFileName :: FilePath
- data FourmoluConfig = FourmoluConfig {}
- emptyConfig :: FourmoluConfig
- data ConfigFileLoadResult
Documentation
Ormolu configuration.
Constructors
Config | |
Fields
|
Instances
Functor Config # | |
Generic (Config region) # | |
Show region => Show (Config region) # | |
Eq region => Eq (Config region) # | |
type Rep (Config region) # | |
Defined in Ormolu.Config type Rep (Config region) = D1 ('MetaData "Config" "Ormolu.Config" "fourmolu-0.14.1.0-2wQij9nkG5b1W1cxrUIOrR" 'False) (C1 ('MetaCons "Config" 'PrefixI 'True) (((S1 ('MetaSel ('Just "cfgDynOptions") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [DynOption]) :*: S1 ('MetaSel ('Just "cfgFixityOverrides") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FixityOverrides)) :*: (S1 ('MetaSel ('Just "cfgModuleReexports") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ModuleReexports) :*: (S1 ('MetaSel ('Just "cfgDependencies") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Set PackageName)) :*: S1 ('MetaSel ('Just "cfgUnsafe") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)))) :*: ((S1 ('MetaSel ('Just "cfgDebug") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "cfgCheckIdempotence") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "cfgSourceType") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SourceType))) :*: (S1 ('MetaSel ('Just "cfgColorMode") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ColorMode) :*: (S1 ('MetaSel ('Just "cfgRegion") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 region) :*: S1 ('MetaSel ('Just "cfgPrinterOpts") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PrinterOptsTotal)))))) |
Whether to use colors and other features of ANSI terminals.
Instances
Bounded ColorMode # | |
Enum ColorMode # | |
Defined in Ormolu.Terminal Methods succ :: ColorMode -> ColorMode # pred :: ColorMode -> ColorMode # fromEnum :: ColorMode -> Int # enumFrom :: ColorMode -> [ColorMode] # enumFromThen :: ColorMode -> ColorMode -> [ColorMode] # enumFromTo :: ColorMode -> ColorMode -> [ColorMode] # enumFromThenTo :: ColorMode -> ColorMode -> ColorMode -> [ColorMode] # | |
Show ColorMode # | |
Eq ColorMode # | |
data RegionIndices #
Region selection as the combination of start and end line numbers.
Constructors
RegionIndices | |
Fields
|
Instances
Show RegionIndices # | |
Defined in Ormolu.Config Methods showsPrec :: Int -> RegionIndices -> ShowS # show :: RegionIndices -> String # showList :: [RegionIndices] -> ShowS # | |
Eq RegionIndices # | |
Defined in Ormolu.Config Methods (==) :: RegionIndices -> RegionIndices -> Bool # (/=) :: RegionIndices -> RegionIndices -> Bool # |
data RegionDeltas #
Region selection as the length of the literal prefix and the literal suffix.
Constructors
RegionDeltas | |
Fields
|
Instances
Show RegionDeltas # | |
Defined in Ormolu.Config Methods showsPrec :: Int -> RegionDeltas -> ShowS # show :: RegionDeltas -> String # showList :: [RegionDeltas] -> ShowS # | |
Eq RegionDeltas # | |
Defined in Ormolu.Config |
data SourceType #
Type of sources that can be formatted by Ormolu.
Constructors
ModuleSource | Consider the input as a regular Haskell module |
SignatureSource | Consider the input as a Backpack module signature |
Instances
Show SourceType # | |
Defined in Ormolu.Config Methods showsPrec :: Int -> SourceType -> ShowS # show :: SourceType -> String # showList :: [SourceType] -> ShowS # | |
Eq SourceType # | |
Defined in Ormolu.Config |
defaultConfig :: Config RegionIndices #
Default
.Config
RegionIndices
overapproximatedDependencies :: Config region -> Set PackageName #
Return all dependencies of the module. This includes both the declared dependencies of the component we are working with and all potential module re-export targets.
Arguments
:: Int | Total number of lines in the input |
-> RegionIndices | Region indices |
-> RegionDeltas | Region deltas |
Convert RegionIndices
into RegionDeltas
.
A wrapper for dynamic options.
Constructors
DynOption | |
Fields |
Instances
Show DynOption # | |
Eq DynOption # | |
Ord DynOption # | |
Fourmolu configuration
data PrinterOpts f #
Options controlling formatting output.
Constructors
PrinterOpts | |
Fields
|
Instances
type PrinterOptsPartial = PrinterOpts Maybe #
A version of PrinterOpts
where any field can be empty.
This corresponds to the information in a config file or in CLI options.
type PrinterOptsTotal = PrinterOpts Identity #
A version of PrinterOpts
without empty fields.
fillMissingPrinterOpts :: forall f. Applicative f => PrinterOpts Maybe -> PrinterOpts f -> PrinterOpts f #
Fill the field values that are Nothing
in the first argument
with the values of the corresponding fields of the second argument.
resolvePrinterOpts :: [PrinterOptsPartial] -> PrinterOptsTotal #
Apply the given configuration in order (later options override earlier).
data CommaStyle #
Instances
FromJSON CommaStyle # | |
Defined in Ormolu.Config.Gen | |
Bounded CommaStyle # | |
Defined in Ormolu.Config.Gen | |
Enum CommaStyle # | |
Defined in Ormolu.Config.Gen Methods succ :: CommaStyle -> CommaStyle # pred :: CommaStyle -> CommaStyle # toEnum :: Int -> CommaStyle # fromEnum :: CommaStyle -> Int # enumFrom :: CommaStyle -> [CommaStyle] # enumFromThen :: CommaStyle -> CommaStyle -> [CommaStyle] # enumFromTo :: CommaStyle -> CommaStyle -> [CommaStyle] # enumFromThenTo :: CommaStyle -> CommaStyle -> CommaStyle -> [CommaStyle] # | |
Show CommaStyle # | |
Defined in Ormolu.Config.Gen Methods showsPrec :: Int -> CommaStyle -> ShowS # show :: CommaStyle -> String # showList :: [CommaStyle] -> ShowS # | |
Eq CommaStyle # | |
Defined in Ormolu.Config.Gen |
data FunctionArrowsStyle #
Constructors
TrailingArrows | |
LeadingArrows | |
LeadingArgsArrows |
Instances
data HaddockPrintStyle #
Constructors
HaddockSingleLine | |
HaddockMultiLine | |
HaddockMultiLineCompact |
Instances
data HaddockPrintStyleModule #
Constructors
PrintStyleInherit | |
PrintStyleOverride HaddockPrintStyle |
Instances
FromJSON HaddockPrintStyleModule # | |
Defined in Ormolu.Config.Gen Methods parseJSON :: Value -> Parser HaddockPrintStyleModule # parseJSONList :: Value -> Parser [HaddockPrintStyleModule] # | |
Show HaddockPrintStyleModule # | |
Defined in Ormolu.Config.Gen Methods showsPrec :: Int -> HaddockPrintStyleModule -> ShowS # show :: HaddockPrintStyleModule -> String # showList :: [HaddockPrintStyleModule] -> ShowS # | |
Eq HaddockPrintStyleModule # | |
Defined in Ormolu.Config.Gen Methods (==) :: HaddockPrintStyleModule -> HaddockPrintStyleModule -> Bool # (/=) :: HaddockPrintStyleModule -> HaddockPrintStyleModule -> Bool # |
data ImportExportStyle #
Instances
Constructors
LetAuto | |
LetInline | |
LetNewline | |
LetMixed |
Instances
FromJSON LetStyle # | |
Defined in Ormolu.Config.Gen | |
Bounded LetStyle # | |
Enum LetStyle # | |
Defined in Ormolu.Config.Gen | |
Show LetStyle # | |
Eq LetStyle # | |
Constructors
InLeftAlign | |
InRightAlign | |
InNoSpace |
Instances
FromJSON InStyle # | |
Defined in Ormolu.Config.Gen | |
Bounded InStyle # | |
Enum InStyle # | |
Show InStyle # | |
Eq InStyle # | |
Constructors
UnicodeDetect | |
UnicodeAlways | |
UnicodeNever |
Instances
FromJSON Unicode # | |
Defined in Ormolu.Config.Gen | |
Bounded Unicode # | |
Enum Unicode # | |
Show Unicode # | |
Eq Unicode # | |
data ColumnLimit #
Constructors
NoLimit | |
ColumnLimit Int |
Instances
FromJSON ColumnLimit # | |
Defined in Ormolu.Config.Gen | |
Show ColumnLimit # | |
Defined in Ormolu.Config.Gen Methods showsPrec :: Int -> ColumnLimit -> ShowS # show :: ColumnLimit -> String # showList :: [ColumnLimit] -> ShowS # | |
Eq ColumnLimit # | |
Defined in Ormolu.Config.Gen |
parsePrinterOptsCLI :: Applicative f => (forall a. PrinterOptsFieldType a => String -> String -> String -> f (Maybe a)) -> f (PrinterOpts Maybe) #
parsePrinterOptType :: PrinterOptsFieldType a => String -> Either String a #
Loading Fourmolu configuration
loadConfigFile :: FilePath -> IO ConfigFileLoadResult #
Read options from a config file, if found.
Looks recursively in parent folders, then in XdgConfig
,
for a file named fourmolu.yaml.
Expected file name for YAML config.
data FourmoluConfig #
Constructors
FourmoluConfig | |
Instances
FromJSON FourmoluConfig # | |
Defined in Ormolu.Config Methods parseJSON :: Value -> Parser FourmoluConfig # parseJSONList :: Value -> Parser [FourmoluConfig] # | |
Show FourmoluConfig # | |
Defined in Ormolu.Config Methods showsPrec :: Int -> FourmoluConfig -> ShowS # show :: FourmoluConfig -> String # showList :: [FourmoluConfig] -> ShowS # | |
Eq FourmoluConfig # | |
Defined in Ormolu.Config Methods (==) :: FourmoluConfig -> FourmoluConfig -> Bool # (/=) :: FourmoluConfig -> FourmoluConfig -> Bool # |
data ConfigFileLoadResult #
The result of calling loadConfigFile
.
Constructors
ConfigLoaded FilePath FourmoluConfig | |
ConfigParseError FilePath ParseException | |
ConfigNotFound [FilePath] |
Instances
Show ConfigFileLoadResult # | |
Defined in Ormolu.Config Methods showsPrec :: Int -> ConfigFileLoadResult -> ShowS # show :: ConfigFileLoadResult -> String # showList :: [ConfigFileLoadResult] -> ShowS # |