haskell-src-exts-1.13.5: Manipulating Haskell source: abstract syntax, lexer, parser, and pretty-printer

Portability | portable
Stability | stable
Maintainer | Niklas Broberg, d00nibro@chalmers.se
Safe Haskell | None

Language.Haskell.Exts

Contents

- Re-exported modules
- Parsing of Haskell source files
- Read extensions declared in LANGUAGE pragmas

Description

An umbrella module for the various functionality of the package. Also provides some convenient functionality for dealing directly with source files.

Synopsis

- module Language.Haskell.Exts.Syntax
- module Language.Haskell.Exts.Build
- module Language.Haskell.Exts.Lexer
- module Language.Haskell.Exts.Parser
- module Language.Haskell.Exts.Pretty
- module Language.Haskell.Exts.Extension
- module Language.Haskell.Exts.Fixity
- module Language.Haskell.Exts.Comments
- parseFile :: FilePath -> IO (ParseResult Module)
- parseFileWithMode :: ParseMode -> FilePath -> IO (ParseResult Module)
- parseFileWithExts :: [Extension] -> FilePath -> IO (ParseResult Module)
- parseFileWithComments :: ParseMode -> FilePath -> IO (ParseResult (Module, [Comment]))
- parseFileContents :: String -> ParseResult Module
- parseFileContentsWithMode :: ParseMode -> String -> ParseResult Module
- parseFileContentsWithExts :: [Extension] -> String -> ParseResult Module
- parseFileContentsWithComments :: ParseMode -> String -> ParseResult (Module, [Comment])
- readExtensions :: String -> Maybe [Extension]

# Re-exported modules

module Language.Haskell.Exts.Syntax

module Language.Haskell.Exts.Build

module Language.Haskell.Exts.Lexer

module Language.Haskell.Exts.Parser

module Language.Haskell.Exts.Pretty

module Language.Haskell.Exts.Extension

module Language.Haskell.Exts.Fixity

module Language.Haskell.Exts.Comments

# Parsing of Haskell source files

parseFile :: FilePath -> IO (ParseResult Module)

Parse a source file on disk, using the default parse mode.

parseFileWithMode :: ParseMode -> FilePath -> IO (ParseResult Module)

Parse a source file on disk, supplying a custom parse mode.

parseFileWithExts :: [Extension] -> FilePath -> IO (ParseResult Module)

Parse a source file on disk, with an extra set of extensions to know about on top of what the file itself declares.

parseFileWithComments :: ParseMode -> FilePath -> IO (ParseResult (Module, [Comment]))

Parse a source file on disk, supplying a custom parse mode, and retaining comments.

parseFileContents :: String -> ParseResult Module

Parse a source file from a string using the default parse mode.

parseFileContentsWithMode :: ParseMode -> String -> ParseResult Module

Parse a source file from a string using a custom parse mode.

parseFileContentsWithExts :: [Extension] -> String -> ParseResult Module

Parse a source file from a string, with an extra set of extensions to know about on top of what the file itself declares.

parseFileContentsWithComments :: ParseMode -> String -> ParseResult (Module, [Comment])

Parse a source file from a string using a custom parse mode and retaining comments.

# Read extensions declared in LANGUAGE pragmas

readExtensions :: String -> Maybe [Extension]

Gather the extensions declared in LANGUAGE pragmas at the top of the file. Returns `Nothing` if the parse of the pragmas fails.