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

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

Language.Haskell.Exts.SrcLoc

Description

This module defines various data types representing source location information, of varying degree of preciseness.

Synopsis

- showInt :: Int -> String
- data SrcLoc = SrcLoc {
  - srcFilename :: String
  - srcLine :: Int
  - srcColumn :: Int
  }
- noLoc :: SrcLoc
- data SrcSpan = SrcSpan {
  - srcSpanFilename :: String
  - srcSpanStartLine :: Int
  - srcSpanStartColumn :: Int
  - srcSpanEndLine :: Int
  - srcSpanEndColumn :: Int
  }
- srcSpanStart :: SrcSpan -> (Int, Int)
- srcSpanEnd :: SrcSpan -> (Int, Int)
- mkSrcSpan :: SrcLoc -> SrcLoc -> SrcSpan
- mergeSrcSpan :: SrcSpan -> SrcSpan -> SrcSpan
- isNullSpan :: SrcSpan -> Bool
- spanSize :: SrcSpan -> (Int, Int)
- data Loc a = Loc {
  - loc :: SrcSpan
  - unLoc :: a
  }
- data SrcSpanInfo = SrcSpanInfo {
  - srcInfoSpan :: SrcSpan
  - srcInfoPoints :: [SrcSpan]
  }
- noInfoSpan :: SrcSpan -> SrcSpanInfo
- noSrcSpan :: SrcSpanInfo
- infoSpan :: SrcSpan -> [SrcSpan] -> SrcSpanInfo
- combSpanInfo :: SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo
- combSpanMaybe :: SrcSpanInfo -> Maybe SrcSpanInfo -> SrcSpanInfo
- (<++>) :: SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo
- (<+?>) :: SrcSpanInfo -> Maybe SrcSpanInfo -> SrcSpanInfo
- (<?+>) :: Maybe SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo
- (<**) :: SrcSpanInfo -> [SrcSpan] -> SrcSpanInfo
- (<^^>) :: SrcSpan -> SrcSpan -> SrcSpanInfo
- class SrcInfo si where
  - toSrcInfo :: SrcLoc -> [SrcSpan] -> SrcLoc -> si
  - fromSrcInfo :: SrcSpanInfo -> si
  - getPointLoc :: si -> SrcLoc
  - fileName :: si -> String
  - startLine :: si -> Int
  - startColumn :: si -> Int

# Documentation

showInt :: Int -> String #

data SrcLoc #

A single position in the source.

Constructors

SrcLoc |
Fields srcFilename :: String srcLine :: Int srcColumn :: Int

#### Instances

Instances details

Data SrcLoc # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SrcLoc -> c SrcLoc # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SrcLoc # toConstr :: SrcLoc -> Constr # dataTypeOf :: SrcLoc -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SrcLoc) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SrcLoc) # gmapT :: (forall b. Data b => b -> b) -> SrcLoc -> SrcLoc # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SrcLoc -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SrcLoc -> r # gmapQ :: (forall d. Data d => d -> u) -> SrcLoc -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SrcLoc -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc #
Generic SrcLoc # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Associated Types
type Rep SrcLoc |
Instance details Defined in Language.Haskell.Exts.SrcLoc type Rep SrcLoc = D1 ('MetaData "SrcLoc" "Language.Haskell.Exts.SrcLoc" "haskell-src-exts-1.23.1-FOI5Fu7za2w1QQR9FkfSpN" 'False) (C1 ('MetaCons "SrcLoc" 'PrefixI 'True) (S1 ('MetaSel ('Just "srcFilename") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: (S1 ('MetaSel ('Just "srcLine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "srcColumn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))))
Methods from :: SrcLoc -> Rep SrcLoc x # to :: Rep SrcLoc x -> SrcLoc #
Show SrcLoc # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods showsPrec :: Int -> SrcLoc -> ShowS # show :: SrcLoc -> String # showList :: [SrcLoc] -> ShowS #
Eq SrcLoc # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods (==) :: SrcLoc -> SrcLoc -> Bool # (/=) :: SrcLoc -> SrcLoc -> Bool #
Ord SrcLoc # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods compare :: SrcLoc -> SrcLoc -> Ordering # (<) :: SrcLoc -> SrcLoc -> Bool # (<=) :: SrcLoc -> SrcLoc -> Bool # (>) :: SrcLoc -> SrcLoc -> Bool # (>=) :: SrcLoc -> SrcLoc -> Bool # max :: SrcLoc -> SrcLoc -> SrcLoc # min :: SrcLoc -> SrcLoc -> SrcLoc #
Pretty SrcLoc # |
Instance details Defined in Language.Haskell.Exts.Pretty Methods pretty :: SrcLoc -> Doc prettyPrec :: Int -> SrcLoc -> Doc
SrcInfo SrcLoc # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods toSrcInfo :: SrcLoc -> [SrcSpan] -> SrcLoc -> SrcLoc # fromSrcInfo :: SrcSpanInfo -> SrcLoc # getPointLoc :: SrcLoc -> SrcLoc # fileName :: SrcLoc -> String # startLine :: SrcLoc -> Int # startColumn :: SrcLoc -> Int #
type Rep SrcLoc # |
Instance details Defined in Language.Haskell.Exts.SrcLoc type Rep SrcLoc = D1 ('MetaData "SrcLoc" "Language.Haskell.Exts.SrcLoc" "haskell-src-exts-1.23.1-FOI5Fu7za2w1QQR9FkfSpN" 'False) (C1 ('MetaCons "SrcLoc" 'PrefixI 'True) (S1 ('MetaSel ('Just "srcFilename") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: (S1 ('MetaSel ('Just "srcLine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "srcColumn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))))

noLoc :: SrcLoc #

data SrcSpan #

A portion of the source, spanning one or more lines and zero or more columns.

Constructors

SrcSpan |
Fields srcSpanFilename :: String srcSpanStartLine :: Int srcSpanStartColumn :: Int srcSpanEndLine :: Int srcSpanEndColumn :: Int

#### Instances

Instances details

Data SrcSpan # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SrcSpan -> c SrcSpan # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SrcSpan # toConstr :: SrcSpan -> Constr # dataTypeOf :: SrcSpan -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SrcSpan) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SrcSpan) # gmapT :: (forall b. Data b => b -> b) -> SrcSpan -> SrcSpan # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SrcSpan -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SrcSpan -> r # gmapQ :: (forall d. Data d => d -> u) -> SrcSpan -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SrcSpan -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan #
Generic SrcSpan # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Associated Types
type Rep SrcSpan |
Instance details Defined in Language.Haskell.Exts.SrcLoc type Rep SrcSpan = D1 ('MetaData "SrcSpan" "Language.Haskell.Exts.SrcLoc" "haskell-src-exts-1.23.1-FOI5Fu7za2w1QQR9FkfSpN" 'False) (C1 ('MetaCons "SrcSpan" 'PrefixI 'True) ((S1 ('MetaSel ('Just "srcSpanFilename") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "srcSpanStartLine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "srcSpanStartColumn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: (S1 ('MetaSel ('Just "srcSpanEndLine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "srcSpanEndColumn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))))
Methods from :: SrcSpan -> Rep SrcSpan x # to :: Rep SrcSpan x -> SrcSpan #
Show SrcSpan # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods showsPrec :: Int -> SrcSpan -> ShowS # show :: SrcSpan -> String # showList :: [SrcSpan] -> ShowS #
Eq SrcSpan # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods (==) :: SrcSpan -> SrcSpan -> Bool # (/=) :: SrcSpan -> SrcSpan -> Bool #
Ord SrcSpan # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods compare :: SrcSpan -> SrcSpan -> Ordering # (<) :: SrcSpan -> SrcSpan -> Bool # (<=) :: SrcSpan -> SrcSpan -> Bool # (>) :: SrcSpan -> SrcSpan -> Bool # (>=) :: SrcSpan -> SrcSpan -> Bool # max :: SrcSpan -> SrcSpan -> SrcSpan # min :: SrcSpan -> SrcSpan -> SrcSpan #
Pretty SrcSpan # |
Instance details Defined in Language.Haskell.Exts.Pretty Methods pretty :: SrcSpan -> Doc prettyPrec :: Int -> SrcSpan -> Doc
SrcInfo SrcSpan # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods toSrcInfo :: SrcLoc -> [SrcSpan] -> SrcLoc -> SrcSpan # fromSrcInfo :: SrcSpanInfo -> SrcSpan # getPointLoc :: SrcSpan -> SrcLoc # fileName :: SrcSpan -> String # startLine :: SrcSpan -> Int # startColumn :: SrcSpan -> Int #
type Rep SrcSpan # |
Instance details Defined in Language.Haskell.Exts.SrcLoc type Rep SrcSpan = D1 ('MetaData "SrcSpan" "Language.Haskell.Exts.SrcLoc" "haskell-src-exts-1.23.1-FOI5Fu7za2w1QQR9FkfSpN" 'False) (C1 ('MetaCons "SrcSpan" 'PrefixI 'True) ((S1 ('MetaSel ('Just "srcSpanFilename") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "srcSpanStartLine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "srcSpanStartColumn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: (S1 ('MetaSel ('Just "srcSpanEndLine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "srcSpanEndColumn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))))

srcSpanStart :: SrcSpan -> (Int, Int) #

Returns `srcSpanStartLine` and `srcSpanStartColumn` in a pair.

srcSpanEnd :: SrcSpan -> (Int, Int) #

Returns `srcSpanEndLine` and `srcSpanEndColumn` in a pair.

mkSrcSpan :: SrcLoc -> SrcLoc -> SrcSpan #

Combine two locations in the source to denote a span.

mergeSrcSpan :: SrcSpan -> SrcSpan -> SrcSpan #

Merge two source spans into a single span from the start of the first to the end of the second. Assumes that the two spans relate to the same source file.

isNullSpan :: SrcSpan -> Bool #

Test if a given span starts and ends at the same location.

spanSize :: SrcSpan -> (Int, Int) #

data Loc a #

An entity located in the source.

Constructors

Loc |
Fields loc :: SrcSpan unLoc :: a

#### Instances

Instances details

Generic (Loc a) # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Associated Types
type Rep (Loc a) |
Instance details Defined in Language.Haskell.Exts.SrcLoc type Rep (Loc a) = D1 ('MetaData "Loc" "Language.Haskell.Exts.SrcLoc" "haskell-src-exts-1.23.1-FOI5Fu7za2w1QQR9FkfSpN" 'False) (C1 ('MetaCons "Loc" 'PrefixI 'True) (S1 ('MetaSel ('Just "loc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SrcSpan) :*: S1 ('MetaSel ('Just "unLoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
Methods from :: Loc a -> Rep (Loc a) x # to :: Rep (Loc a) x -> Loc a #
Show a => Show (Loc a) # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods showsPrec :: Int -> Loc a -> ShowS # show :: Loc a -> String # showList :: [Loc a] -> ShowS #
Eq a => Eq (Loc a) # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods (==) :: Loc a -> Loc a -> Bool # (/=) :: Loc a -> Loc a -> Bool #
Ord a => Ord (Loc a) # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods compare :: Loc a -> Loc a -> Ordering # (<) :: Loc a -> Loc a -> Bool # (<=) :: Loc a -> Loc a -> Bool # (>) :: Loc a -> Loc a -> Bool # (>=) :: Loc a -> Loc a -> Bool # max :: Loc a -> Loc a -> Loc a # min :: Loc a -> Loc a -> Loc a #
type Rep (Loc a) # |
Instance details Defined in Language.Haskell.Exts.SrcLoc type Rep (Loc a) = D1 ('MetaData "Loc" "Language.Haskell.Exts.SrcLoc" "haskell-src-exts-1.23.1-FOI5Fu7za2w1QQR9FkfSpN" 'False) (C1 ('MetaCons "Loc" 'PrefixI 'True) (S1 ('MetaSel ('Just "loc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SrcSpan) :*: S1 ('MetaSel ('Just "unLoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

data SrcSpanInfo #

A portion of the source, extended with information on the position of entities within the span.

Constructors

SrcSpanInfo |
Fields srcInfoSpan :: SrcSpan srcInfoPoints :: [SrcSpan]

#### Instances

Instances details

Data SrcSpanInfo # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SrcSpanInfo -> c SrcSpanInfo # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SrcSpanInfo # toConstr :: SrcSpanInfo -> Constr # dataTypeOf :: SrcSpanInfo -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SrcSpanInfo) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SrcSpanInfo) # gmapT :: (forall b. Data b => b -> b) -> SrcSpanInfo -> SrcSpanInfo # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SrcSpanInfo -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SrcSpanInfo -> r # gmapQ :: (forall d. Data d => d -> u) -> SrcSpanInfo -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SrcSpanInfo -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SrcSpanInfo -> m SrcSpanInfo # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcSpanInfo -> m SrcSpanInfo # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcSpanInfo -> m SrcSpanInfo #
Generic SrcSpanInfo # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Associated Types
type Rep SrcSpanInfo |
Instance details Defined in Language.Haskell.Exts.SrcLoc type Rep SrcSpanInfo = D1 ('MetaData "SrcSpanInfo" "Language.Haskell.Exts.SrcLoc" "haskell-src-exts-1.23.1-FOI5Fu7za2w1QQR9FkfSpN" 'False) (C1 ('MetaCons "SrcSpanInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "srcInfoSpan") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SrcSpan) :*: S1 ('MetaSel ('Just "srcInfoPoints") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [SrcSpan])))
Methods from :: SrcSpanInfo -> Rep SrcSpanInfo x # to :: Rep SrcSpanInfo x -> SrcSpanInfo #
Show SrcSpanInfo # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods showsPrec :: Int -> SrcSpanInfo -> ShowS # show :: SrcSpanInfo -> String # showList :: [SrcSpanInfo] -> ShowS #
Eq SrcSpanInfo # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods (==) :: SrcSpanInfo -> SrcSpanInfo -> Bool # (/=) :: SrcSpanInfo -> SrcSpanInfo -> Bool #
Ord SrcSpanInfo # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods compare :: SrcSpanInfo -> SrcSpanInfo -> Ordering # (<) :: SrcSpanInfo -> SrcSpanInfo -> Bool # (<=) :: SrcSpanInfo -> SrcSpanInfo -> Bool # (>) :: SrcSpanInfo -> SrcSpanInfo -> Bool # (>=) :: SrcSpanInfo -> SrcSpanInfo -> Bool # max :: SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo # min :: SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo #
SrcInfo SrcSpanInfo # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods toSrcInfo :: SrcLoc -> [SrcSpan] -> SrcLoc -> SrcSpanInfo # fromSrcInfo :: SrcSpanInfo -> SrcSpanInfo # getPointLoc :: SrcSpanInfo -> SrcLoc # fileName :: SrcSpanInfo -> String # startLine :: SrcSpanInfo -> Int # startColumn :: SrcSpanInfo -> Int #
Parseable (NonGreedy (ListOf (ModulePragma SrcSpanInfo))) # |
Instance details Defined in Language.Haskell.Exts.Parser 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)) # |
Instance details Defined in Language.Haskell.Exts.Parser 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)) # |
Instance details Defined in Language.Haskell.Exts.Parser 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)) # |
Instance details Defined in Language.Haskell.Exts.Parser 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))
Parseable (Decl SrcSpanInfo) # |
Instance details Defined in Language.Haskell.Exts.Parser 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 (Exp SrcSpanInfo) # |
Instance details Defined in Language.Haskell.Exts.Parser 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 (ImportDecl SrcSpanInfo) # |
Instance details Defined in Language.Haskell.Exts.Parser 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) # |
Instance details Defined in Language.Haskell.Exts.Parser 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)
Parseable (Pat SrcSpanInfo) # |
Instance details Defined in Language.Haskell.Exts.Parser 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 (Stmt SrcSpanInfo) # |
Instance details Defined in Language.Haskell.Exts.Parser 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 (Type SrcSpanInfo) # |
Instance details Defined in Language.Haskell.Exts.Parser 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)
type Rep SrcSpanInfo # |
Instance details Defined in Language.Haskell.Exts.SrcLoc type Rep SrcSpanInfo = D1 ('MetaData "SrcSpanInfo" "Language.Haskell.Exts.SrcLoc" "haskell-src-exts-1.23.1-FOI5Fu7za2w1QQR9FkfSpN" 'False) (C1 ('MetaCons "SrcSpanInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "srcInfoSpan") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SrcSpan) :*: S1 ('MetaSel ('Just "srcInfoPoints") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [SrcSpan])))

noInfoSpan :: SrcSpan -> SrcSpanInfo #

Generate a `SrcSpanInfo` with no positional information for entities.

noSrcSpan :: SrcSpanInfo #

A bogus `SrcSpanInfo`, the location is `noLoc`. `noSrcSpan = noInfoSpan (mkSrcSpan noLoc noLoc)`

infoSpan :: SrcSpan -> [SrcSpan] -> SrcSpanInfo #

Generate a `SrcSpanInfo` with the supplied positional information for entities.

combSpanInfo :: SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo #

Combine two `SrcSpanInfo`s into one that spans the combined source area of the two arguments, leaving positional information blank.

combSpanMaybe :: SrcSpanInfo -> Maybe SrcSpanInfo -> SrcSpanInfo #

Like `(<+?>)`, but it also concatenates the `srcInfoPoints`.

(<++>) :: SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo infixl 5 #

Short name for `combSpanInfo`

(<+?>) :: SrcSpanInfo -> Maybe SrcSpanInfo -> SrcSpanInfo infixl 4 #

Optionally combine the first argument with the second, or return it unchanged if the second argument is `Nothing`.

(<?+>) :: Maybe SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo infixl 4 #

Optionally combine the second argument with the first, or return it unchanged if the first argument is `Nothing`.

(<**) :: SrcSpanInfo -> [SrcSpan] -> SrcSpanInfo infixl 4 #

Add more positional information for entities of a span.

(<^^>) :: SrcSpan -> SrcSpan -> SrcSpanInfo infixl 6 #

Merge two `SrcSpan`s and lift them to a `SrcInfoSpan` with no positional information for entities.

class SrcInfo si where #

A class to work over all kinds of source location information.

Minimal complete definition

toSrcInfo, fromSrcInfo, fileName, startLine, startColumn

Methods

toSrcInfo :: SrcLoc -> [SrcSpan] -> SrcLoc -> si #

fromSrcInfo :: SrcSpanInfo -> si #

getPointLoc :: si -> SrcLoc #

fileName :: si -> String #

startLine :: si -> Int #

startColumn :: si -> Int #

#### Instances

Instances details

SrcInfo SrcLoc # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods toSrcInfo :: SrcLoc -> [SrcSpan] -> SrcLoc -> SrcLoc # fromSrcInfo :: SrcSpanInfo -> SrcLoc # getPointLoc :: SrcLoc -> SrcLoc # fileName :: SrcLoc -> String # startLine :: SrcLoc -> Int # startColumn :: SrcLoc -> Int #
SrcInfo SrcSpan # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods toSrcInfo :: SrcLoc -> [SrcSpan] -> SrcLoc -> SrcSpan # fromSrcInfo :: SrcSpanInfo -> SrcSpan # getPointLoc :: SrcSpan -> SrcLoc # fileName :: SrcSpan -> String # startLine :: SrcSpan -> Int # startColumn :: SrcSpan -> Int #
SrcInfo SrcSpanInfo # |
Instance details Defined in Language.Haskell.Exts.SrcLoc Methods toSrcInfo :: SrcLoc -> [SrcSpan] -> SrcLoc -> SrcSpanInfo # fromSrcInfo :: SrcSpanInfo -> SrcSpanInfo # getPointLoc :: SrcSpanInfo -> SrcLoc # fileName :: SrcSpanInfo -> String # startLine :: SrcSpanInfo -> Int # startColumn :: SrcSpanInfo -> Int #