fourmolu-0.18.0.0: A formatter for Haskell source code

Safe Haskell | None
Language | GHC2021

Ormolu.Fixity.Parser

Contents

- Raw parsers
- Internal

Description

Parser for fixity maps.

Synopsis

- parseDotOrmolu :: FilePath -> Text -> Either (ParseErrorBundle Text Void) (FixityOverrides, ModuleReexports)
- parseFixityDeclaration :: Text -> Either (ParseErrorBundle Text Void) [(OpName, FixityInfo)]
- parseModuleReexportDeclaration :: Text -> Either (ParseErrorBundle Text Void) (ModuleName, NonEmpty (Maybe PackageName, ModuleName))
- pFixity :: Parser [(OpName, FixityInfo)]
- pOperator :: Parser OpName
- pModuleName :: Parser ModuleName
- pPackageName :: Parser PackageName
- isIdentifierFirstChar :: Char -> Bool
- isIdentifierConstituent :: Char -> Bool
- isOperatorConstituent :: Char -> Bool
- isPackageNameConstituent :: Char -> Bool
- isModuleSegmentFirstChar :: Char -> Bool
- isModuleSegmentConstituent :: Char -> Bool

# Documentation

parseDotOrmolu Source #

Arguments

:: FilePath | Location of the file we are parsing (only for parse errors)
-> Text | File contents to parse
-> Either (ParseErrorBundle Text Void) (FixityOverrides, ModuleReexports) | Parse result

Parse textual representation of `FixityOverrides`.

parseFixityDeclaration Source #

Arguments

:: Text | Text to parse
-> Either (ParseErrorBundle Text Void) [(OpName, FixityInfo)] | Parse result

Parse a single self-contained fixity declaration.

parseModuleReexportDeclaration Source #

Arguments

:: Text | Text to parse
-> Either (ParseErrorBundle Text Void) (ModuleName, NonEmpty (Maybe PackageName, ModuleName)) | Parse result

Parse a single self-contained module re-export declaration.

# Raw parsers

pFixity :: Parser [(OpName, FixityInfo)] Source #

Parse a single fixity declaration, such as

    infixr 4 +++, >>>

pOperator :: Parser OpName Source #

See https://www.haskell.org/onlinereport/haskell2010/haskellch2.html

pModuleName :: Parser ModuleName Source #

pPackageName :: Parser PackageName Source #

# Internal

isIdentifierFirstChar :: Char -> Bool Source #

isIdentifierConstituent :: Char -> Bool Source #

isOperatorConstituent :: Char -> Bool Source #

isPackageNameConstituent :: Char -> Bool Source #

isModuleSegmentFirstChar :: Char -> Bool Source #

isModuleSegmentConstituent :: Char -> Bool Source #