ghc-parser-0.2.4.0: Haskell source parser from GHC.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Haskell.GHC.Parser

Synopsis

Documentation

runParser :: DynFlags -> Parser a -> String -> ParseOutput a Source #

Run a GHC parser on a string. Return success or failure with associated information for both.

type LineNumber = Int Source #

A line number in an input string.

type ColumnNumber = Int Source #

A column number in an input string.

type ErrMsg = String Source #

An error message string.

data StringLoc Source #

A location in an input string.

Instances

Instances details
Show StringLoc Source # 
Instance details

Defined in Language.Haskell.GHC.Parser

Eq StringLoc Source # 
Instance details

Defined in Language.Haskell.GHC.Parser

data ParseOutput a Source #

Output from running a parser.

Constructors

Failure ErrMsg StringLoc

Parser failed with given error message and location.

Parsed a

Parser succeeded with an output.

Partial a (String, String)

Partial parser succeeded with an output.

Instances

Instances details
Show a => Show (ParseOutput a) Source # 
Instance details

Defined in Language.Haskell.GHC.Parser

Eq a => Eq (ParseOutput a) Source # 
Instance details

Defined in Language.Haskell.GHC.Parser

data Parser a Source #

data Located a Source #

Store locations along with a value.

Constructors

Located 

Fields

Instances

Instances details
Functor Located Source # 
Instance details

Defined in Language.Haskell.GHC.Parser

Methods

fmap :: (a -> b) -> Located a -> Located b #

(<$) :: a -> Located b -> Located a #

Show a => Show (Located a) Source # 
Instance details

Defined in Language.Haskell.GHC.Parser

Methods

showsPrec :: Int -> Located a -> ShowS #

show :: Located a -> String #

showList :: [Located a] -> ShowS #

Eq a => Eq (Located a) Source # 
Instance details

Defined in Language.Haskell.GHC.Parser

Methods

(==) :: Located a -> Located a -> Bool #

(/=) :: Located a -> Located a -> Bool #

removeComments :: String -> String Source #

Drop comments from Haskell source. Simply gets rid of them, does not replace them in any way.

layoutChunks :: String -> [Located String] Source #

Split an input string into chunks based on indentation. A chunk is a line and all lines immediately following that are indented beyond the indentation of the first line. This parses Haskell layout rules properly, and allows using multiline expressions via indentation.

Quasiquotes are allowed via a post-processing step.