Language.Haskell.Exts.Parser

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

Copyright | (c) Niklas Broberg 2004-2009 (c) Michael Sloan 2013
License | BSD-style (see the file LICENSE.txt)
Maintainer | Niklas Broberg, d00nibro@chalmers.se
Stability | stable
Portability | portable
Safe Haskell | None
Language | Haskell98

Language.Haskell.Exts.Parser

Contents

- General parsing
- Parsing of specific AST elements
  - Modules
  - Expressions
  - Statements
  - Patterns
  - Declarations
  - Types
  - Imports
- Non-greedy parsers
  - Module head parsers
- Orphan instances

Description

Annotated parser for Haskell with extensions.

Synopsis

- class Parseable ast where
- data ParseMode = ParseMode {
  - parseFilename :: String
  - baseLanguage :: Language
  - extensions :: [Extension]
  - ignoreLanguagePragmas :: Bool
  - ignoreLinePragmas :: Bool
  - fixities :: Maybe [Fixity]
  - ignoreFunctionArity :: Bool
  }
- defaultParseMode :: ParseMode
- data ParseResult a
  - = ParseOk a
  - | ParseFailed SrcLoc String
- fromParseResult :: ParseResult a -> a
- parseModule :: String -> ParseResult (Module SrcSpanInfo)
- parseModuleWithMode :: ParseMode -> String -> ParseResult (Module SrcSpanInfo)
- parseModuleWithComments :: ParseMode -> String -> ParseResult (Module SrcSpanInfo, [Comment])
- parseExp :: String -> ParseResult (Exp SrcSpanInfo)
- parseExpWithMode :: ParseMode -> String -> ParseResult (Exp SrcSpanInfo)
- parseExpWithComments :: ParseMode -> String -> ParseResult (Exp SrcSpanInfo, [Comment])
- parseStmt :: String -> ParseResult (Stmt SrcSpanInfo)
- parseStmtWithMode :: ParseMode -> String -> ParseResult (Stmt SrcSpanInfo)
- parseStmtWithComments :: ParseMode -> String -> ParseResult (Stmt SrcSpanInfo, [Comment])
- parsePat :: String -> ParseResult (Pat SrcSpanInfo)
- parsePatWithMode :: ParseMode -> String -> ParseResult (Pat SrcSpanInfo)
- parsePatWithComments :: ParseMode -> String -> ParseResult (Pat SrcSpanInfo, [Comment])
- parseDecl :: String -> ParseResult (Decl SrcSpanInfo)
- parseDeclWithMode :: ParseMode -> String -> ParseResult (Decl SrcSpanInfo)
- parseDeclWithComments :: ParseMode -> String -> ParseResult (Decl SrcSpanInfo, [Comment])
- parseType :: String -> ParseResult (Type SrcSpanInfo)
- parseTypeWithMode :: ParseMode -> String -> ParseResult (Type SrcSpanInfo)
- parseTypeWithComments :: ParseMode -> String -> ParseResult (Type SrcSpanInfo, [Comment])
- parseImportDecl :: String -> ParseResult (ImportDecl SrcSpanInfo)
- parseImportDeclWithMode :: ParseMode -> String -> ParseResult (ImportDecl SrcSpanInfo)
- parseImportDeclWithComments :: ParseMode -> String -> ParseResult (ImportDecl SrcSpanInfo, [Comment])
- newtype NonGreedy a = NonGreedy {
  - unNonGreedy :: a
  }
- data ListOf a = ListOf SrcSpanInfo [a]
- unListOf :: ListOf a -> [a]
- getTopPragmas :: String -> ParseResult [ModulePragma SrcSpanInfo]
- data PragmasAndModuleName l = PragmasAndModuleName l [ModulePragma l] (Maybe (ModuleName l))
- data PragmasAndModuleHead l = PragmasAndModuleHead l [ModulePragma l] (Maybe (ModuleHead l))
- data ModuleHeadAndImports l = ModuleHeadAndImports l [ModulePragma l] (Maybe (ModuleHead l)) [ImportDecl l]

# General parsing

class Parseable ast where #

Class providing function for parsing at many different types.

Note that for convenience of implementation, the default methods have definitions equivalent to `undefined`. The minimal definition is all of the visible methods.

Minimal complete definition

parser

Methods

parse :: String -> ParseResult ast #

Parse a string with default mode.

parseWithMode :: ParseMode -> String -> ParseResult ast #

Parse a string with an explicit `ParseMode`.

parseWithComments :: ParseMode -> String -> ParseResult (ast, [Comment]) #

Parse a string with an explicit `ParseMode`, returning all comments along with the AST.

Instances

Parseable (NonGreedy (ListOf (ModulePragma SrcSpanInfo))) # |
Methods parse :: String -> ParseResult (NonGreedy (ListOf (ModulePragma SrcSpanInfo))) # parseWithMode :: ParseMode -> String -> ParseResult (NonGreedy (ListOf (ModulePragma SrcSpanInfo))) # parseWithComments :: ParseMode -> String -> ParseResult (NonGreedy (ListOf (ModulePragma SrcSpanInfo)), [Comment]) # parser :: Maybe [Fixity] -> P (NonGreedy (ListOf (ModulePragma SrcSpanInfo)))
Parseable (NonGreedy (ModuleHeadAndImports SrcSpanInfo)) # |
Methods parse :: String -> ParseResult (NonGreedy (ModuleHeadAndImports SrcSpanInfo)) # parseWithMode :: ParseMode -> String -> ParseResult (NonGreedy (ModuleHeadAndImports SrcSpanInfo)) # parseWithComments :: ParseMode -> String -> ParseResult (NonGreedy (ModuleHeadAndImports SrcSpanInfo), [Comment]) # parser :: Maybe [Fixity] -> P (NonGreedy (ModuleHeadAndImports SrcSpanInfo))
Parseable (NonGreedy (PragmasAndModuleHead SrcSpanInfo)) # |
Methods parse :: String -> ParseResult (NonGreedy (PragmasAndModuleHead SrcSpanInfo)) # parseWithMode :: ParseMode -> String -> ParseResult (NonGreedy (PragmasAndModuleHead SrcSpanInfo)) # parseWithComments :: ParseMode -> String -> ParseResult (NonGreedy (PragmasAndModuleHead SrcSpanInfo), [Comment]) # parser :: Maybe [Fixity] -> P (NonGreedy (PragmasAndModuleHead SrcSpanInfo))
Parseable (NonGreedy (PragmasAndModuleName SrcSpanInfo)) # |
Methods parse :: String -> ParseResult (NonGreedy (PragmasAndModuleName SrcSpanInfo)) # parseWithMode :: ParseMode -> String -> ParseResult (NonGreedy (PragmasAndModuleName SrcSpanInfo)) # parseWithComments :: ParseMode -> String -> ParseResult (NonGreedy (PragmasAndModuleName SrcSpanInfo), [Comment]) # parser :: Maybe [Fixity] -> P (NonGreedy (PragmasAndModuleName SrcSpanInfo))

data ParseMode #

Static parameters governing a parse. Note that the various parse functions in Language.Haskell.Exts.Parser never look at LANGUAGE pragmas, regardless of what the `ignoreLanguagePragmas` flag is set to. Only the various `parseFile` functions in Language.Haskell.Exts will act on it, when set to `False`.

Constructors

ParseMode |
Fields parseFilename :: String original name of the file being parsed baseLanguage :: Language base language (e.g. Haskell98, Haskell2010) extensions :: [Extension] list of extensions enabled for parsing ignoreLanguagePragmas :: Bool if `True`, the parser won't care about further extensions in LANGUAGE pragmas in source files ignoreLinePragmas :: Bool if `True`, the parser won't read line position information from LINE pragmas in source files fixities :: Maybe [Fixity] list of fixities to be aware of ignoreFunctionArity :: Bool Checks whether functions have a consistent arity

defaultParseMode :: ParseMode #

Default parameters for a parse. The default is an unknown filename, no extensions (i.e. Haskell 98), don't ignore LANGUAGE pragmas, do ignore LINE pragmas, and be aware of fixities from the `Prelude`.

data ParseResult a #

The result of a parse.

Constructors

ParseOk a | The parse succeeded, yielding a value.
ParseFailed SrcLoc String | The parse failed at the specified source location, with an error message.

Instances

Monad ParseResult # |
Methods (>>=) :: ParseResult a -> (a -> ParseResult b) -> ParseResult b # (>>) :: ParseResult a -> ParseResult b -> ParseResult b # return :: a -> ParseResult a # fail :: String -> ParseResult a #
Functor ParseResult # |
Methods fmap :: (a -> b) -> ParseResult a -> ParseResult b # (<$) :: a -> ParseResult b -> ParseResult a #
Applicative ParseResult # |
Methods pure :: a -> ParseResult a # (<*>) :: ParseResult (a -> b) -> ParseResult a -> ParseResult b # (*>) :: ParseResult a -> ParseResult b -> ParseResult b # (<*) :: ParseResult a -> ParseResult b -> ParseResult a #
Show a => Show (ParseResult a) # |
Methods showsPrec :: Int -> ParseResult a -> ShowS # show :: ParseResult a -> String # showList :: [ParseResult a] -> ShowS #
Monoid m => Monoid (ParseResult m) # |
Methods mempty :: ParseResult m # mappend :: ParseResult m -> ParseResult m -> ParseResult m # mconcat :: [ParseResult m] -> ParseResult m #

fromParseResult :: ParseResult a -> a #

Retrieve the result of a successful parse, throwing an error if the parse is actually not successful.

# Parsing of specific AST elements

## Modules

parseModule :: String -> ParseResult (Module SrcSpanInfo) #

Parse of a string, which should contain a complete Haskell module, using `defaultParseMode`.

parseModuleWithMode :: ParseMode -> String -> ParseResult (Module SrcSpanInfo) #

Parse of a string containing a complete Haskell module, using an explicit `ParseMode`.

parseModuleWithComments :: ParseMode -> String -> ParseResult (Module SrcSpanInfo, [Comment]) #

Parse of a string containing a complete Haskell module, using an explicit `ParseMode`, retaining comments.

## Expressions

parseExp :: String -> ParseResult (Exp SrcSpanInfo) #

Parse of a string containing a Haskell expression, using `defaultParseMode`.

parseExpWithMode :: ParseMode -> String -> ParseResult (Exp SrcSpanInfo) #

Parse of a string containing a Haskell expression, using an explicit `ParseMode`.

parseExpWithComments :: ParseMode -> String -> ParseResult (Exp SrcSpanInfo, [Comment]) #

Parse of a string containing a complete Haskell module, using an explicit `ParseMode`, retaining comments.

## Statements

parseStmt :: String -> ParseResult (Stmt SrcSpanInfo) #

Parse of a string containing a Haskell statement, using `defaultParseMode`.

parseStmtWithMode :: ParseMode -> String -> ParseResult (Stmt SrcSpanInfo) #

Parse of a string containing a Haskell type, using an explicit `ParseMode`.

parseStmtWithComments :: ParseMode -> String -> ParseResult (Stmt SrcSpanInfo, [Comment]) #

Parse of a string containing a complete Haskell module, using an explicit `ParseMode`, retaining comments.

## Patterns

parsePat :: String -> ParseResult (Pat SrcSpanInfo) #

Parse of a string containing a Haskell pattern, using `defaultParseMode`.

parsePatWithMode :: ParseMode -> String -> ParseResult (Pat SrcSpanInfo) #

Parse of a string containing a Haskell pattern, using an explicit `ParseMode`.

parsePatWithComments :: ParseMode -> String -> ParseResult (Pat SrcSpanInfo, [Comment]) #

Parse of a string containing a complete Haskell module, using an explicit `ParseMode`, retaining comments.

## Declarations

parseDecl :: String -> ParseResult (Decl SrcSpanInfo) #

Parse of a string containing a Haskell top-level declaration, using `defaultParseMode`.

parseDeclWithMode :: ParseMode -> String -> ParseResult (Decl SrcSpanInfo) #

Parse of a string containing a Haskell top-level declaration, using an explicit `ParseMode`.

parseDeclWithComments :: ParseMode -> String -> ParseResult (Decl SrcSpanInfo, [Comment]) #

Parse of a string containing a complete Haskell module, using an explicit `ParseMode`, retaining comments.

## Types

parseType :: String -> ParseResult (Type SrcSpanInfo) #

Parse of a string containing a Haskell type, using `defaultParseMode`.

parseTypeWithMode :: ParseMode -> String -> ParseResult (Type SrcSpanInfo) #

Parse of a string containing a Haskell type, using an explicit `ParseMode`.

parseTypeWithComments :: ParseMode -> String -> ParseResult (Type SrcSpanInfo, [Comment]) #

Parse of a string containing a complete Haskell module, using an explicit `ParseMode`, retaining comments.

## Imports

parseImportDecl :: String -> ParseResult (ImportDecl SrcSpanInfo) #

Parse of a string containing a Haskell statement, using `defaultParseMode`.

parseImportDeclWithMode :: ParseMode -> String -> ParseResult (ImportDecl SrcSpanInfo) #

Parse of a string containing a Haskell type, using an explicit `ParseMode`.

parseImportDeclWithComments :: ParseMode -> String -> ParseResult (ImportDecl SrcSpanInfo, [Comment]) #

Parse of a string containing a complete Haskell module, using an explicit `ParseMode`, retaining comments.

# Non-greedy parsers

newtype NonGreedy a #

Instances of `Parseable` for `NonGreedy a` will only consume the input until `a` is fully parsed. This means that parse errors that come later in the input will be ignored. It's also more efficient, as it's fully lazy in the remainder of the input:

    >>> parse (unlines ("module A where" : "main =" : repeat "blah")) :: ParseResult PragmasAndModuleHead
    ParseOk (NonGreedy {unNonGreedy = PragmasAndModuleHead [] (ModuleName "A",Nothing,Nothing)})

(this example uses the simplified AST)

Constructors

NonGreedy |
Fields unNonGreedy :: a

Instances

Functor NonGreedy # |
Methods fmap :: (a -> b) -> NonGreedy a -> NonGreedy b # (<$) :: a -> NonGreedy b -> NonGreedy a #
Eq a => Eq (NonGreedy a) # |
Methods (==) :: NonGreedy a -> NonGreedy a -> Bool # (/=) :: NonGreedy a -> NonGreedy a -> Bool #
Data a => Data (NonGreedy a) # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> NonGreedy a -> c (NonGreedy a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (NonGreedy a) # toConstr :: NonGreedy a -> Constr # dataTypeOf :: NonGreedy a -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (NonGreedy a)) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (NonGreedy a)) # gmapT :: (forall b. Data b => b -> b) -> NonGreedy a -> NonGreedy a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NonGreedy a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NonGreedy a -> r # gmapQ :: (forall d. Data d => d -> u) -> NonGreedy a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> NonGreedy a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> NonGreedy a -> m (NonGreedy a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> NonGreedy a -> m (NonGreedy a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> NonGreedy a -> m (NonGreedy a) #
Ord a => Ord (NonGreedy a) # |
Methods compare :: NonGreedy a -> NonGreedy a -> Ordering # (<) :: NonGreedy a -> NonGreedy a -> Bool # (<=) :: NonGreedy a -> NonGreedy a -> Bool # (>) :: NonGreedy a -> NonGreedy a -> Bool # (>=) :: NonGreedy a -> NonGreedy a -> Bool # max :: NonGreedy a -> NonGreedy a -> NonGreedy a # min :: NonGreedy a -> NonGreedy a -> NonGreedy a #
Show a => Show (NonGreedy a) # |
Methods showsPrec :: Int -> NonGreedy a -> ShowS # show :: NonGreedy a -> String # showList :: [NonGreedy a] -> ShowS #
Parseable (NonGreedy (ListOf (ModulePragma SrcSpanInfo))) # |
Methods parse :: String -> ParseResult (NonGreedy (ListOf (ModulePragma SrcSpanInfo))) # parseWithMode :: ParseMode -> String -> ParseResult (NonGreedy (ListOf (ModulePragma SrcSpanInfo))) # parseWithComments :: ParseMode -> String -> ParseResult (NonGreedy (ListOf (ModulePragma SrcSpanInfo)), [Comment]) # parser :: Maybe [Fixity] -> P (NonGreedy (ListOf (ModulePragma SrcSpanInfo)))
Parseable (NonGreedy (ModuleHeadAndImports SrcSpanInfo)) # |
Methods parse :: String -> ParseResult (NonGreedy (ModuleHeadAndImports SrcSpanInfo)) # parseWithMode :: ParseMode -> String -> ParseResult (NonGreedy (ModuleHeadAndImports SrcSpanInfo)) # parseWithComments :: ParseMode -> String -> ParseResult (NonGreedy (ModuleHeadAndImports SrcSpanInfo), [Comment]) # parser :: Maybe [Fixity] -> P (NonGreedy (ModuleHeadAndImports SrcSpanInfo))
Parseable (NonGreedy (PragmasAndModuleHead SrcSpanInfo)) # |
Methods parse :: String -> ParseResult (NonGreedy (PragmasAndModuleHead SrcSpanInfo)) # parseWithMode :: ParseMode -> String -> ParseResult (NonGreedy (PragmasAndModuleHead SrcSpanInfo)) # parseWithComments :: ParseMode -> String -> ParseResult (NonGreedy (PragmasAndModuleHead SrcSpanInfo), [Comment]) # parser :: Maybe [Fixity] -> P (NonGreedy (PragmasAndModuleHead SrcSpanInfo))
Parseable (NonGreedy (PragmasAndModuleName SrcSpanInfo)) # |
Methods parse :: String -> ParseResult (NonGreedy (PragmasAndModuleName SrcSpanInfo)) # parseWithMode :: ParseMode -> String -> ParseResult (NonGreedy (PragmasAndModuleName SrcSpanInfo)) # parseWithComments :: ParseMode -> String -> ParseResult (NonGreedy (PragmasAndModuleName SrcSpanInfo), [Comment]) # parser :: Maybe [Fixity] -> P (NonGreedy (PragmasAndModuleName SrcSpanInfo))

data ListOf a #

`ListOf a` stores lists of the AST type `a`, along with a `SrcSpanInfo`, in order to provide `Parseable` instances for lists. These instances are provided when the type is used as a list in the syntax, and the same delimiters are used in all of its usages. Some exceptions are made:

Constructors

ListOf SrcSpanInfo [a] |

Instances

Functor ListOf # |
Methods fmap :: (a -> b) -> ListOf a -> ListOf b # (<$) :: a -> ListOf b -> ListOf a #
Eq a => Eq (ListOf a) # |
Methods (==) :: ListOf a -> ListOf a -> Bool # (/=) :: ListOf a -> ListOf a -> Bool #
Data a => Data (ListOf a) # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ListOf a -> c (ListOf a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ListOf a) # toConstr :: ListOf a -> Constr # dataTypeOf :: ListOf a -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (ListOf a)) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ListOf a)) # gmapT :: (forall b. Data b => b -> b) -> ListOf a -> ListOf a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ListOf a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ListOf a -> r # gmapQ :: (forall d. Data d => d -> u) -> ListOf a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ListOf a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ListOf a -> m (ListOf a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ListOf a -> m (ListOf a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ListOf a -> m (ListOf a) #
Ord a => Ord (ListOf a) # |
Methods compare :: ListOf a -> ListOf a -> Ordering # (<) :: ListOf a -> ListOf a -> Bool # (<=) :: ListOf a -> ListOf a -> Bool # (>) :: ListOf a -> ListOf a -> Bool # (>=) :: ListOf a -> ListOf a -> Bool # max :: ListOf a -> ListOf a -> ListOf a # min :: ListOf a -> ListOf a -> ListOf a #
Show a => Show (ListOf a) # |
Methods showsPrec :: Int -> ListOf a -> ShowS # show :: ListOf a -> String # showList :: [ListOf a] -> ShowS #
Parseable (NonGreedy (ListOf (ModulePragma SrcSpanInfo))) # |
Methods parse :: String -> ParseResult (NonGreedy (ListOf (ModulePragma SrcSpanInfo))) # parseWithMode :: ParseMode -> String -> ParseResult (NonGreedy (ListOf (ModulePragma SrcSpanInfo))) # parseWithComments :: ParseMode -> String -> ParseResult (NonGreedy (ListOf (ModulePragma SrcSpanInfo)), [Comment]) # parser :: Maybe [Fixity] -> P (NonGreedy (ListOf (ModulePragma SrcSpanInfo)))

unListOf :: ListOf a -> [a] #

## Module head parsers

getTopPragmas :: String -> ParseResult [ModulePragma SrcSpanInfo] #

Non-greedy parse of a string starting with a series of top-level option pragmas.

data PragmasAndModuleName l #

Type intended to be used with `Parseable`, with instances that implement a non-greedy parse of the module name, including top-level pragmas. This means that a parse error that comes after the module header won't be returned. If the `Maybe` value is `Nothing`, then this means that there was no module header.

Constructors

PragmasAndModuleName l [ModulePragma l] (Maybe (ModuleName l)) |

Instances

Eq l => Eq (PragmasAndModuleName l) # |
Methods (==) :: PragmasAndModuleName l -> PragmasAndModuleName l -> Bool # (/=) :: PragmasAndModuleName l -> PragmasAndModuleName l -> Bool #
Data l => Data (PragmasAndModuleName l) # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PragmasAndModuleName l -> c (PragmasAndModuleName l) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (PragmasAndModuleName l) # toConstr :: PragmasAndModuleName l -> Constr # dataTypeOf :: PragmasAndModuleName l -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (PragmasAndModuleName l)) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (PragmasAndModuleName l)) # gmapT :: (forall b. Data b => b -> b) -> PragmasAndModuleName l -> PragmasAndModuleName l # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PragmasAndModuleName l -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PragmasAndModuleName l -> r # gmapQ :: (forall d. Data d => d -> u) -> PragmasAndModuleName l -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> PragmasAndModuleName l -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> PragmasAndModuleName l -> m (PragmasAndModuleName l) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PragmasAndModuleName l -> m (PragmasAndModuleName l) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PragmasAndModuleName l -> m (PragmasAndModuleName l) #
Ord l => Ord (PragmasAndModuleName l) # |
Methods compare :: PragmasAndModuleName l -> PragmasAndModuleName l -> Ordering # (<) :: PragmasAndModuleName l -> PragmasAndModuleName l -> Bool # (<=) :: PragmasAndModuleName l -> PragmasAndModuleName l -> Bool # (>) :: PragmasAndModuleName l -> PragmasAndModuleName l -> Bool # (>=) :: PragmasAndModuleName l -> PragmasAndModuleName l -> Bool # max :: PragmasAndModuleName l -> PragmasAndModuleName l -> PragmasAndModuleName l # min :: PragmasAndModuleName l -> PragmasAndModuleName l -> PragmasAndModuleName l #
Show l => Show (PragmasAndModuleName l) # |
Methods showsPrec :: Int -> PragmasAndModuleName l -> ShowS # show :: PragmasAndModuleName l -> String # showList :: [PragmasAndModuleName l] -> ShowS #
Parseable (NonGreedy (PragmasAndModuleName SrcSpanInfo)) # |
Methods parse :: String -> ParseResult (NonGreedy (PragmasAndModuleName SrcSpanInfo)) # parseWithMode :: ParseMode -> String -> ParseResult (NonGreedy (PragmasAndModuleName SrcSpanInfo)) # parseWithComments :: ParseMode -> String -> ParseResult (NonGreedy (PragmasAndModuleName SrcSpanInfo), [Comment]) # parser :: Maybe [Fixity] -> P (NonGreedy (PragmasAndModuleName SrcSpanInfo))

data PragmasAndModuleHead l #

Constructors

PragmasAndModuleHead l [ModulePragma l] (Maybe (ModuleHead l)) |

Instances

Eq l => Eq (PragmasAndModuleHead l) # |
Methods (==) :: PragmasAndModuleHead l -> PragmasAndModuleHead l -> Bool # (/=) :: PragmasAndModuleHead l -> PragmasAndModuleHead l -> Bool #
Data l => Data (PragmasAndModuleHead l) # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PragmasAndModuleHead l -> c (PragmasAndModuleHead l) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (PragmasAndModuleHead l) # toConstr :: PragmasAndModuleHead l -> Constr # dataTypeOf :: PragmasAndModuleHead l -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (PragmasAndModuleHead l)) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (PragmasAndModuleHead l)) # gmapT :: (forall b. Data b => b -> b) -> PragmasAndModuleHead l -> PragmasAndModuleHead l # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PragmasAndModuleHead l -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PragmasAndModuleHead l -> r # gmapQ :: (forall d. Data d => d -> u) -> PragmasAndModuleHead l -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> PragmasAndModuleHead l -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> PragmasAndModuleHead l -> m (PragmasAndModuleHead l) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PragmasAndModuleHead l -> m (PragmasAndModuleHead l) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PragmasAndModuleHead l -> m (PragmasAndModuleHead l) #
Ord l => Ord (PragmasAndModuleHead l) # |
Methods compare :: PragmasAndModuleHead l -> PragmasAndModuleHead l -> Ordering # (<) :: PragmasAndModuleHead l -> PragmasAndModuleHead l -> Bool # (<=) :: PragmasAndModuleHead l -> PragmasAndModuleHead l -> Bool # (>) :: PragmasAndModuleHead l -> PragmasAndModuleHead l -> Bool # (>=) :: PragmasAndModuleHead l -> PragmasAndModuleHead l -> Bool # max :: PragmasAndModuleHead l -> PragmasAndModuleHead l -> PragmasAndModuleHead l # min :: PragmasAndModuleHead l -> PragmasAndModuleHead l -> PragmasAndModuleHead l #
Show l => Show (PragmasAndModuleHead l) # |
Methods showsPrec :: Int -> PragmasAndModuleHead l -> ShowS # show :: PragmasAndModuleHead l -> String # showList :: [PragmasAndModuleHead l] -> ShowS #
Parseable (NonGreedy (PragmasAndModuleHead SrcSpanInfo)) # |
Methods parse :: String -> ParseResult (NonGreedy (PragmasAndModuleHead SrcSpanInfo)) # parseWithMode :: ParseMode -> String -> ParseResult (NonGreedy (PragmasAndModuleHead SrcSpanInfo)) # parseWithComments :: ParseMode -> String -> ParseResult (NonGreedy (PragmasAndModuleHead SrcSpanInfo), [Comment]) # parser :: Maybe [Fixity] -> P (NonGreedy (PragmasAndModuleHead SrcSpanInfo))

data ModuleHeadAndImports l #

Constructors

ModuleHeadAndImports l [ModulePragma l] (Maybe (ModuleHead l)) [ImportDecl l] |

Instances

Eq l => Eq (ModuleHeadAndImports l) # |
Methods (==) :: ModuleHeadAndImports l -> ModuleHeadAndImports l -> Bool # (/=) :: ModuleHeadAndImports l -> ModuleHeadAndImports l -> Bool #
Data l => Data (ModuleHeadAndImports l) # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ModuleHeadAndImports l -> c (ModuleHeadAndImports l) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ModuleHeadAndImports l) # toConstr :: ModuleHeadAndImports l -> Constr # dataTypeOf :: ModuleHeadAndImports l -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (ModuleHeadAndImports l)) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ModuleHeadAndImports l)) # gmapT :: (forall b. Data b => b -> b) -> ModuleHeadAndImports l -> ModuleHeadAndImports l # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ModuleHeadAndImports l -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ModuleHeadAndImports l -> r # gmapQ :: (forall d. Data d => d -> u) -> ModuleHeadAndImports l -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ModuleHeadAndImports l -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ModuleHeadAndImports l -> m (ModuleHeadAndImports l) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ModuleHeadAndImports l -> m (ModuleHeadAndImports l) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ModuleHeadAndImports l -> m (ModuleHeadAndImports l) #
Ord l => Ord (ModuleHeadAndImports l) # |
Methods compare :: ModuleHeadAndImports l -> ModuleHeadAndImports l -> Ordering # (<) :: ModuleHeadAndImports l -> ModuleHeadAndImports l -> Bool # (<=) :: ModuleHeadAndImports l -> ModuleHeadAndImports l -> Bool # (>) :: ModuleHeadAndImports l -> ModuleHeadAndImports l -> Bool # (>=) :: ModuleHeadAndImports l -> ModuleHeadAndImports l -> Bool # max :: ModuleHeadAndImports l -> ModuleHeadAndImports l -> ModuleHeadAndImports l # min :: ModuleHeadAndImports l -> ModuleHeadAndImports l -> ModuleHeadAndImports l #
Show l => Show (ModuleHeadAndImports l) # |
Methods showsPrec :: Int -> ModuleHeadAndImports l -> ShowS # show :: ModuleHeadAndImports l -> String # showList :: [ModuleHeadAndImports l] -> ShowS #
Parseable (NonGreedy (ModuleHeadAndImports SrcSpanInfo)) # |
Methods parse :: String -> ParseResult (NonGreedy (ModuleHeadAndImports SrcSpanInfo)) # parseWithMode :: ParseMode -> String -> ParseResult (NonGreedy (ModuleHeadAndImports SrcSpanInfo)) # parseWithComments :: ParseMode -> String -> ParseResult (NonGreedy (ModuleHeadAndImports SrcSpanInfo), [Comment]) # parser :: Maybe [Fixity] -> P (NonGreedy (ModuleHeadAndImports SrcSpanInfo))

# Orphan instances

Parseable (Stmt SrcSpanInfo) # |
Methods parse :: String -> ParseResult (Stmt SrcSpanInfo) # parseWithMode :: ParseMode -> String -> ParseResult (Stmt SrcSpanInfo) # parseWithComments :: ParseMode -> String -> ParseResult (Stmt SrcSpanInfo, [Comment]) # parser :: Maybe [Fixity] -> P (Stmt SrcSpanInfo)
Parseable (Pat SrcSpanInfo) # |
Methods parse :: String -> ParseResult (Pat SrcSpanInfo) # parseWithMode :: ParseMode -> String -> ParseResult (Pat SrcSpanInfo) # parseWithComments :: ParseMode -> String -> ParseResult (Pat SrcSpanInfo, [Comment]) # parser :: Maybe [Fixity] -> P (Pat SrcSpanInfo)
Parseable (Exp SrcSpanInfo) # |
Methods parse :: String -> ParseResult (Exp SrcSpanInfo) # parseWithMode :: ParseMode -> String -> ParseResult (Exp SrcSpanInfo) # parseWithComments :: ParseMode -> String -> ParseResult (Exp SrcSpanInfo, [Comment]) # parser :: Maybe [Fixity] -> P (Exp SrcSpanInfo)
Parseable (Type SrcSpanInfo) # |
Methods parse :: String -> ParseResult (Type SrcSpanInfo) # parseWithMode :: ParseMode -> String -> ParseResult (Type SrcSpanInfo) # parseWithComments :: ParseMode -> String -> ParseResult (Type SrcSpanInfo, [Comment]) # parser :: Maybe [Fixity] -> P (Type SrcSpanInfo)
Parseable (Decl SrcSpanInfo) # |
Methods parse :: String -> ParseResult (Decl SrcSpanInfo) # parseWithMode :: ParseMode -> String -> ParseResult (Decl SrcSpanInfo) # parseWithComments :: ParseMode -> String -> ParseResult (Decl SrcSpanInfo, [Comment]) # parser :: Maybe [Fixity] -> P (Decl SrcSpanInfo)
Parseable (ImportDecl SrcSpanInfo) # |
Methods parse :: String -> ParseResult (ImportDecl SrcSpanInfo) # parseWithMode :: ParseMode -> String -> ParseResult (ImportDecl SrcSpanInfo) # parseWithComments :: ParseMode -> String -> ParseResult (ImportDecl SrcSpanInfo, [Comment]) # parser :: Maybe [Fixity] -> P (ImportDecl SrcSpanInfo)
Parseable (Module SrcSpanInfo) # |
Methods parse :: String -> ParseResult (Module SrcSpanInfo) # parseWithMode :: ParseMode -> String -> ParseResult (Module SrcSpanInfo) # parseWithComments :: ParseMode -> String -> ParseResult (Module SrcSpanInfo, [Comment]) # parser :: Maybe [Fixity] -> P (Module SrcSpanInfo)