fourmolu-0.9.0.0: A formatter for Haskell source code
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ormolu.Fixity

Description

Definitions for fixity analysis.

Synopsis

Documentation

data FixityDirection Source #

Fixity direction.

Constructors

InfixL 
InfixR 
InfixN 

Instances

Instances details
FromJSON FixityDirection Source # 
Instance details

Defined in Ormolu.Fixity.Internal

ToJSON FixityDirection Source # 
Instance details

Defined in Ormolu.Fixity.Internal

Show FixityDirection Source # 
Instance details

Defined in Ormolu.Fixity.Internal

Eq FixityDirection Source # 
Instance details

Defined in Ormolu.Fixity.Internal

Ord FixityDirection Source # 
Instance details

Defined in Ormolu.Fixity.Internal

Lift FixityDirection Source # 
Instance details

Defined in Ormolu.Fixity.Internal

Methods

lift :: Quote m => FixityDirection -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => FixityDirection -> Code m FixityDirection #

data FixityInfo Source #

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

Constructors

FixityInfo 

Fields

Instances

Instances details
FromJSON FixityInfo Source # 
Instance details

Defined in Ormolu.Fixity.Internal

ToJSON FixityInfo Source # 
Instance details

Defined in Ormolu.Fixity.Internal

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

Show FixityInfo Source # 
Instance details

Defined in Ormolu.Fixity.Internal

Eq FixityInfo Source # 
Instance details

Defined in Ormolu.Fixity.Internal

Ord FixityInfo Source # 
Instance details

Defined in Ormolu.Fixity.Internal

Lift FixityInfo Source # 
Instance details

Defined in Ormolu.Fixity.Internal

Methods

lift :: Quote m => FixityInfo -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => FixityInfo -> Code m FixityInfo #

type FixityMap = Map String FixityInfo Source #

Map from the operator name to its FixityInfo.

data LazyFixityMap Source #

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

Instances

Instances details
Show LazyFixityMap Source # 
Instance details

Defined in Ormolu.Fixity.Internal

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

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

data HackageInfo Source #

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

Constructors

HackageInfo 

Fields

  • (Map String FixityMap)

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

  • (Map String Int)

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

Instances

Instances details
FromJSON HackageInfo Source # 
Instance details

Defined in Ormolu.Fixity.Internal

ToJSON HackageInfo Source # 
Instance details

Defined in Ormolu.Fixity.Internal

Lift HackageInfo Source # 
Instance details

Defined in Ormolu.Fixity.Internal

Methods

lift :: Quote m => HackageInfo -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => HackageInfo -> Code m HackageInfo #

defaultStrategyThreshold :: Float Source #

The default value for the popularity ratio threshold, after which a very popular definition from packageToOps will completely rule out conflicting definitions instead of being merged with them.

defaultFixityInfo :: FixityInfo Source #

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

buildFixityMap Source #

Arguments

:: Float

Popularity ratio threshold, after which a very popular package will completely rule out conflicting definitions coming from other packages instead of being merged with them

-> Set String

Explicitly known dependencies

-> LazyFixityMap

Resulting map

Build a fixity map using the given popularity threshold and a list of cabal dependencies. Dependencies from the list have higher priority than other packages.

buildFixityMap' Source #

Arguments

:: Map String FixityMap

Map from package to fixity map for operators defined in this package

-> Map String Int

Map from package to popularity

-> Set String

Higher priority packages

-> Float

Popularity ratio threshold, after which a very popular package will completely rule out conflicting definitions coming from other packages instead of being merged with them

-> Set String

Explicitly known dependencies

-> LazyFixityMap

Resulting map

Build a fixity map using the given popularity threshold and a list of cabal dependencies. Dependencies from the list have higher priority than other packages. This specific version of the function allows the user to specify the package databases used to build the final fixity map.

bootPackages :: Set String Source #

List of packages shipped with GHC, for which the download count from Hackage does not reflect their high popularity. See https://github.com/tweag/ormolu/pull/830#issuecomment-986609572. "base" is not is this list, because it is already whitelisted by buildFixityMap'.