-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell source parser from GHC. -- -- Haskell source parser from GHC. @package ghc-parser @version 0.1.3.0 module Language.Haskell.GHC.HappyParser fullModule :: P (Located (HsModule RdrName)) fullTypeSignature :: P (LHsDecl RdrName) fullStatement :: P (LStmt RdrName) fullExpression :: P (LHsExpr RdrName) fullImport :: P (LImportDecl RdrName) fullDeclaration :: P (OrdList (LHsDecl RdrName)) partialModule :: P (Located (HsModule RdrName)) partialTypeSignature :: P (LHsDecl RdrName) partialStatement :: P (LStmt RdrName) partialExpression :: P (LHsExpr RdrName) partialImport :: P (LImportDecl RdrName) partialDeclaration :: P (OrdList (LHsDecl RdrName)) module Language.Haskell.GHC.Parser -- | Run a GHC parser on a string. Return success or failure with -- associated information for both. runParser :: DynFlags -> Parser a -> String -> ParseOutput a -- | A line number in an input string. type LineNumber = Int -- | A column number in an input string. type ColumnNumber = Int -- | An error message string. type ErrMsg = String -- | A location in an input string. data StringLoc Loc :: LineNumber -> ColumnNumber -> StringLoc -- | Output from running a parser. data ParseOutput a -- | Parser failed with given error message and location. Failure :: ErrMsg -> StringLoc -> ParseOutput a -- | Parser succeeded with an output. Parsed :: a -> ParseOutput a -- | Partial parser succeeded with an output. Partial :: a -> (String, String) -> ParseOutput a data Parser a -- | Store locations along with a value. data Located a Located :: LineNumber -> a -> Located a line :: Located a -> LineNumber unloc :: Located a -> a parserStatement :: Parser (LStmt RdrName) parserImport :: Parser (LImportDecl RdrName) parserDeclaration :: Parser (OrdList (LHsDecl RdrName)) parserTypeSignature :: Parser (LHsDecl RdrName) parserModule :: Parser (Located (HsModule RdrName)) parserExpression :: Parser (LHsExpr RdrName) partialStatement :: Parser (LStmt RdrName) partialImport :: Parser (LImportDecl RdrName) partialDeclaration :: Parser (OrdList (LHsDecl RdrName)) partialTypeSignature :: Parser (LHsDecl RdrName) partialModule :: Parser (Located (HsModule RdrName)) partialExpression :: Parser (LHsExpr RdrName) -- | Drop comments from Haskell source. Simply gets rid of them, does not -- replace them in any way. removeComments :: String -> String -- | 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. layoutChunks :: String -> [Located String] instance Show StringLoc instance Eq StringLoc instance Eq a => Eq (ParseOutput a) instance Show a => Show (ParseOutput a) instance Eq a => Eq (Located a) instance Show a => Show (Located a) instance Functor Located