ormolu-0.7.2.0: A formatter for Haskell source code

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
  }
- data ColorMode
  - = Never
  - | Always
  - | Auto
- data RegionIndices = RegionIndices {
  - regionStartLine :: !(Maybe Int)
  - regionEndLine :: !(Maybe Int)
  }
- data RegionDeltas = RegionDeltas {
  - regionPrefixLength :: !Int
  - regionSuffixLength :: !Int
  }
- data SourceType
  - = ModuleSource
  - | SignatureSource
- defaultConfig :: Config RegionIndices
- overapproximatedDependencies :: Config region -> Set PackageName
- regionIndicesToDeltas :: Int -> RegionIndices -> RegionDeltas
- newtype DynOption = DynOption {
  - unDynOption :: String
  }
- dynOptionToLocatedStr :: DynOption -> Located String

# Documentation

data Config region Source #

Ormolu configuration.

Constructors

Config |

Fields

- cfgDynOptions :: ![DynOption]

  Dynamic options to pass to GHC parser

- cfgFixityOverrides :: !FixityOverrides

  Fixity overrides

- cfgModuleReexports :: !ModuleReexports

  Module reexports to take into account when doing fixity resolution

- cfgDependencies :: !(Set PackageName)

  Known dependencies, if any

- cfgUnsafe :: !Bool

  Do formatting faster but without automatic detection of defects

- cfgDebug :: !Bool

  Output information useful for debugging

- cfgCheckIdempotence :: !Bool

  Checks if re-formatting the result is idempotent

- cfgSourceType :: !SourceType

  How to parse the input (regular haskell module or Backpack file)

- cfgColorMode :: !ColorMode

  Whether to use colors and other features of ANSI terminals

- cfgRegion :: !region

  Region selection

#### Instances

Instances details

Functor Config Source # |
Instance details Defined in Ormolu.Config Methods fmap :: (a -> b) -> Config a -> Config b Source # (<$) :: a -> Config b -> Config a Source #
Generic (Config region) Source # |
Instance details Defined in Ormolu.Config Associated Types type Rep (Config region) :: Type -> Type Source # Methods from :: Config region -> Rep (Config region) x Source # to :: Rep (Config region) x -> Config region Source #
Show region => Show (Config region) Source # |
Instance details Defined in Ormolu.Config Methods showsPrec :: Int -> Config region -> ShowS Source # show :: Config region -> String Source # showList :: [Config region] -> ShowS Source #
Eq region => Eq (Config region) Source # |
Instance details Defined in Ormolu.Config Methods (==) :: Config region -> Config region -> Bool Source # (/=) :: Config region -> Config region -> Bool Source #
type Rep (Config region) Source # |

Instance details

Defined in Ormolu.Config

type Rep (Config region) = D1 ('MetaData "Config" "Ormolu.Config" "ormolu-0.7.2.0-1grVQCptuVT9shMyI7dLqj" '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))))))

data ColorMode Source #

Whether to use colors and other features of ANSI terminals.

Constructors

Never |
Always |
Auto |

#### Instances

Instances details

Show ColorMode Source # |
Instance details Defined in Ormolu.Terminal Methods showsPrec :: Int -> ColorMode -> ShowS Source # show :: ColorMode -> String Source # showList :: [ColorMode] -> ShowS Source #
Eq ColorMode Source # |
Instance details Defined in Ormolu.Terminal Methods (==) :: ColorMode -> ColorMode -> Bool Source # (/=) :: ColorMode -> ColorMode -> Bool Source #

data RegionIndices Source #

Region selection as the combination of start and end line numbers.

Constructors

RegionIndices |

Fields

- regionStartLine :: !(Maybe Int)

  Start line of the region to format

- regionEndLine :: !(Maybe Int)

  End line of the region to format

#### Instances

Instances details

Show RegionIndices Source # |
Instance details Defined in Ormolu.Config Methods showsPrec :: Int -> RegionIndices -> ShowS Source # show :: RegionIndices -> String Source # showList :: [RegionIndices] -> ShowS Source #
Eq RegionIndices Source # |
Instance details Defined in Ormolu.Config Methods (==) :: RegionIndices -> RegionIndices -> Bool Source # (/=) :: RegionIndices -> RegionIndices -> Bool Source #

data RegionDeltas Source #

Region selection as the length of the literal prefix and the literal suffix.

Constructors

RegionDeltas |

Fields

- regionPrefixLength :: !Int

  Prefix length in number of lines

- regionSuffixLength :: !Int

  Suffix length in number of lines

#### Instances

Instances details

Show RegionDeltas Source # |
Instance details Defined in Ormolu.Config Methods showsPrec :: Int -> RegionDeltas -> ShowS Source # show :: RegionDeltas -> String Source # showList :: [RegionDeltas] -> ShowS Source #
Eq RegionDeltas Source # |
Instance details Defined in Ormolu.Config Methods (==) :: RegionDeltas -> RegionDeltas -> Bool Source # (/=) :: RegionDeltas -> RegionDeltas -> Bool Source #

data SourceType Source #

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

Instances details

Show SourceType Source # |
Instance details Defined in Ormolu.Config Methods showsPrec :: Int -> SourceType -> ShowS Source # show :: SourceType -> String Source # showList :: [SourceType] -> ShowS Source #
Eq SourceType Source # |
Instance details Defined in Ormolu.Config Methods (==) :: SourceType -> SourceType -> Bool Source # (/=) :: SourceType -> SourceType -> Bool Source #

defaultConfig :: Config RegionIndices Source #

Default ``Config` `RegionIndices``.

overapproximatedDependencies :: Config region -> Set PackageName Source #

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.

regionIndicesToDeltas Source #

Arguments

:: Int | Total number of lines in the input
-> RegionIndices | Region indices
-> RegionDeltas | Region deltas

Convert `RegionIndices` into `RegionDeltas`.

newtype DynOption Source #

A wrapper for dynamic options.

Constructors

DynOption |

Fields

- unDynOption :: String

#### Instances

Instances details

Show DynOption Source # |
Instance details Defined in Ormolu.Config Methods showsPrec :: Int -> DynOption -> ShowS Source # show :: DynOption -> String Source # showList :: [DynOption] -> ShowS Source #
Eq DynOption Source # |
Instance details Defined in Ormolu.Config Methods (==) :: DynOption -> DynOption -> Bool Source # (/=) :: DynOption -> DynOption -> Bool Source #
Ord DynOption Source # |
Instance details Defined in Ormolu.Config Methods compare :: DynOption -> DynOption -> Ordering Source # (<) :: DynOption -> DynOption -> Bool Source # (<=) :: DynOption -> DynOption -> Bool Source # (>) :: DynOption -> DynOption -> Bool Source # (>=) :: DynOption -> DynOption -> Bool Source # max :: DynOption -> DynOption -> DynOption Source # min :: DynOption -> DynOption -> DynOption Source #

dynOptionToLocatedStr :: DynOption -> Located String Source #

Convert `DynOption` to ``Located` `String``.