ormolu-0.5.3.0: A formatter for Haskell source code

Safe Haskell | Safe-Inferred
Language | Haskell2010

Ormolu.Fixity.Internal

Synopsis

- data OpName
- pattern OpName :: Text -> OpName
- unOpName :: OpName -> Text
- occOpName :: OccName -> OpName
- data FixityDirection
  - = InfixL
  - | InfixR
  - | InfixN
- data FixityInfo = FixityInfo {
  - fiDirection :: Maybe FixityDirection
  - fiMinPrecedence :: Int
  - fiMaxPrecedence :: Int
  }
- defaultFixityInfo :: FixityInfo
- colonFixityInfo :: FixityInfo
- data HackageInfo = HackageInfo (Map PackageName FixityMap) (Map PackageName Int)
- type FixityMap = Map OpName FixityInfo
- newtype LazyFixityMap = LazyFixityMap [FixityMap]
- lookupFixity :: OpName -> LazyFixityMap -> Maybe FixityInfo

# Documentation

data OpName Source #

An operator name.

#### Instances

Instances details

IsString OpName Source # |
Instance details Defined in Ormolu.Fixity.Internal Methods fromString :: String -> OpName Source #
Show OpName Source # |
Instance details Defined in Ormolu.Fixity.Internal Methods showsPrec :: Int -> OpName -> ShowS Source # show :: OpName -> String Source # showList :: [OpName] -> ShowS Source #
Binary OpName Source # |
Instance details Defined in Ormolu.Fixity.Internal Methods put :: OpName -> Put Source # get :: Get OpName Source # putList :: [OpName] -> Put Source #
Eq OpName Source # |
Instance details Defined in Ormolu.Fixity.Internal Methods (==) :: OpName -> OpName -> Bool Source # (/=) :: OpName -> OpName -> Bool Source #
Ord OpName Source # |
Instance details Defined in Ormolu.Fixity.Internal Methods compare :: OpName -> OpName -> Ordering Source # (<) :: OpName -> OpName -> Bool Source # (<=) :: OpName -> OpName -> Bool Source # (>) :: OpName -> OpName -> Bool Source # (>=) :: OpName -> OpName -> Bool Source # max :: OpName -> OpName -> OpName Source # min :: OpName -> OpName -> OpName Source #

pattern OpName :: Text -> OpName Source #

unOpName :: OpName -> Text Source #

Convert an `OpName` to `Text`.

occOpName :: OccName -> OpName Source #

Convert an 'OccName to an `OpName`.

data FixityDirection Source #

Fixity direction.

Constructors

InfixL |
InfixR |
InfixN |

#### Instances

Instances details

Generic FixityDirection Source # |
Instance details Defined in Ormolu.Fixity.Internal Associated Types type Rep FixityDirection :: Type -> Type Source # Methods from :: FixityDirection -> Rep FixityDirection x Source # to :: Rep FixityDirection x -> FixityDirection Source #
Show FixityDirection Source # |
Instance details Defined in Ormolu.Fixity.Internal Methods showsPrec :: Int -> FixityDirection -> ShowS Source # show :: FixityDirection -> String Source # showList :: [FixityDirection] -> ShowS Source #
Binary FixityDirection Source # |
Instance details Defined in Ormolu.Fixity.Internal Methods put :: FixityDirection -> Put Source # get :: Get FixityDirection Source # putList :: [FixityDirection] -> Put Source #
Eq FixityDirection Source # |
Instance details Defined in Ormolu.Fixity.Internal Methods (==) :: FixityDirection -> FixityDirection -> Bool Source # (/=) :: FixityDirection -> FixityDirection -> Bool Source #
Ord FixityDirection Source # |

Instance details

Defined in Ormolu.Fixity.Internal

Methods

compare :: FixityDirection -> FixityDirection -> Ordering Source #

(<) :: FixityDirection -> FixityDirection -> Bool Source #

(<=) :: FixityDirection -> FixityDirection -> Bool Source #

(>) :: FixityDirection -> FixityDirection -> Bool Source #

(>=) :: FixityDirection -> FixityDirection -> Bool Source #

max :: FixityDirection -> FixityDirection -> FixityDirection Source #

min :: FixityDirection -> FixityDirection -> FixityDirection Source #

type Rep FixityDirection Source # |
Instance details Defined in Ormolu.Fixity.Internal type Rep FixityDirection = D1 ('MetaData "FixityDirection" "Ormolu.Fixity.Internal" "ormolu-0.5.3.0-FuEfS2eynJT1kHaZbWMcjW" 'False) (C1 ('MetaCons "InfixL" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "InfixR" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "InfixN" 'PrefixI 'False) (U1 :: Type -> Type)))

data FixityInfo Source #

Fixity information about an infix operator that takes the uncertainty that can arise from conflicting definitions into account.

Constructors

FixityInfo |

Fields

- fiDirection :: Maybe FixityDirection

  Fixity direction if it is known

- fiMinPrecedence :: Int

  Minimum precedence level found in the (maybe conflicting) definitions for the operator (inclusive)

- fiMaxPrecedence :: Int

  Maximum precedence level found in the (maybe conflicting) definitions for the operator (inclusive)

#### Instances

Instances details

Semigroup FixityInfo Source # | Gives the ability to merge two (maybe conflicting) definitions for an operator, keeping the higher level of compatible information from both.
Instance details Defined in Ormolu.Fixity.Internal Methods (<>) :: FixityInfo -> FixityInfo -> FixityInfo Source # sconcat :: NonEmpty FixityInfo -> FixityInfo Source # stimes :: Integral b => b -> FixityInfo -> FixityInfo Source #
Generic FixityInfo Source # |
Instance details Defined in Ormolu.Fixity.Internal Associated Types type Rep FixityInfo :: Type -> Type Source # Methods from :: FixityInfo -> Rep FixityInfo x Source # to :: Rep FixityInfo x -> FixityInfo Source #
Show FixityInfo Source # |
Instance details Defined in Ormolu.Fixity.Internal Methods showsPrec :: Int -> FixityInfo -> ShowS Source # show :: FixityInfo -> String Source # showList :: [FixityInfo] -> ShowS Source #
Binary FixityInfo Source # |
Instance details Defined in Ormolu.Fixity.Internal Methods put :: FixityInfo -> Put Source # get :: Get FixityInfo Source # putList :: [FixityInfo] -> Put Source #
Eq FixityInfo Source # |
Instance details Defined in Ormolu.Fixity.Internal Methods (==) :: FixityInfo -> FixityInfo -> Bool Source # (/=) :: FixityInfo -> FixityInfo -> Bool Source #
Ord FixityInfo Source # |

Instance details

Defined in Ormolu.Fixity.Internal

Methods

compare :: FixityInfo -> FixityInfo -> Ordering Source #

(<) :: FixityInfo -> FixityInfo -> Bool Source #

(<=) :: FixityInfo -> FixityInfo -> Bool Source #

(>) :: FixityInfo -> FixityInfo -> Bool Source #

(>=) :: FixityInfo -> FixityInfo -> Bool Source #

max :: FixityInfo -> FixityInfo -> FixityInfo Source #

min :: FixityInfo -> FixityInfo -> FixityInfo Source #

type Rep FixityInfo Source # |

Instance details

Defined in Ormolu.Fixity.Internal

type Rep FixityInfo = D1 ('MetaData "FixityInfo" "Ormolu.Fixity.Internal" "ormolu-0.5.3.0-FuEfS2eynJT1kHaZbWMcjW" 'False) (C1 ('MetaCons "FixityInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "fiDirection") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe FixityDirection)) :*: (S1 ('MetaSel ('Just "fiMinPrecedence") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "fiMaxPrecedence") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))))

defaultFixityInfo :: FixityInfo Source #

The lowest level of information we can have about an operator.

colonFixityInfo :: FixityInfo Source #

Fixity info of the built-in colon data constructor.

data HackageInfo Source #

The map of operators declared by each package and the popularity of each package, if available.

Constructors

HackageInfo |

Fields

- (Map PackageName FixityMap)

  Map from package name to a map from operator name to its fixity

- (Map PackageName Int)

  Map from package name to its 30-days download count from Hackage

#### Instances

Instances details

Generic HackageInfo Source # |
Instance details Defined in Ormolu.Fixity.Internal Associated Types type Rep HackageInfo :: Type -> Type Source # Methods from :: HackageInfo -> Rep HackageInfo x Source # to :: Rep HackageInfo x -> HackageInfo Source #
Binary HackageInfo Source # |
Instance details Defined in Ormolu.Fixity.Internal Methods put :: HackageInfo -> Put Source # get :: Get HackageInfo Source # putList :: [HackageInfo] -> Put Source #
type Rep HackageInfo Source # |

Instance details

Defined in Ormolu.Fixity.Internal

type Rep HackageInfo = D1 ('MetaData "HackageInfo" "Ormolu.Fixity.Internal" "ormolu-0.5.3.0-FuEfS2eynJT1kHaZbWMcjW" 'False) (C1 ('MetaCons "HackageInfo" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map PackageName FixityMap)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map PackageName Int))))

type FixityMap = Map OpName FixityInfo Source #

Map from the operator name to its `FixityInfo`.

newtype LazyFixityMap Source #

A variant of `FixityMap`, represented as a lazy union of several `FixityMap`s.

Constructors

LazyFixityMap [FixityMap] |

#### Instances

Instances details

Show LazyFixityMap Source # |
Instance details Defined in Ormolu.Fixity.Internal Methods showsPrec :: Int -> LazyFixityMap -> ShowS Source # show :: LazyFixityMap -> String Source # showList :: [LazyFixityMap] -> ShowS Source #

lookupFixity :: OpName -> LazyFixityMap -> Maybe FixityInfo Source #

Lookup a `FixityInfo` of an operator. This might have drastically different performance depending on whether this is an "unusual" operator.