srcloc-0.6.0.1: Data types for managing source code locations.
Copyright(c) Harvard University 2006-2011
(c) Geoffrey Mainland 2011-2015
LicenseBSD-style
MaintainerGeoffrey Mainland <mainland@cs.drexel.edu>
Safe HaskellSafe
LanguageHaskell2010

Data.Loc

Description

 
Synopsis

Documentation

data Pos Source #

Position type.

Constructors

Pos !FilePath !Int !Int !Int

Source file name, line, column, and character offset.

Line numbering starts at 1, column offset starts at 1, and character offset starts at 0.

Instances

Instances details
Data Pos Source # 
Instance details

Defined in Data.Loc

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Pos -> c Pos Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Pos Source #

toConstr :: Pos -> Constr Source #

dataTypeOf :: Pos -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Pos) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pos) Source #

gmapT :: (forall b. Data b => b -> b) -> Pos -> Pos Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pos -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pos -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Pos -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Pos -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Pos -> m Pos Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Pos -> m Pos Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Pos -> m Pos Source #

Read Pos Source # 
Instance details

Defined in Data.Loc

Show Pos Source # 
Instance details

Defined in Data.Loc

Eq Pos Source # 
Instance details

Defined in Data.Loc

Methods

(==) :: Pos -> Pos -> Bool Source #

(/=) :: Pos -> Pos -> Bool Source #

Ord Pos Source # 
Instance details

Defined in Data.Loc

Methods

compare :: Pos -> Pos -> Ordering Source #

(<) :: Pos -> Pos -> Bool Source #

(<=) :: Pos -> Pos -> Bool Source #

(>) :: Pos -> Pos -> Bool Source #

(>=) :: Pos -> Pos -> Bool Source #

max :: Pos -> Pos -> Pos Source #

min :: Pos -> Pos -> Pos Source #

Located Pos Source # 
Instance details

Defined in Data.Loc

Methods

locOf :: Pos -> Loc Source #

locOfList :: [Pos] -> Loc Source #

posFile :: Pos -> FilePath Source #

Position file.

posLine :: Pos -> Int Source #

Position line.

posCol :: Pos -> Int Source #

Position column.

posCoff :: Pos -> Int Source #

Position character offset.

startPos :: FilePath -> Pos Source #

Starting position for given file.

linePos :: FilePath -> Int -> Pos Source #

Position corresponding to given file and line.

Note that the associated character offset is set to 0.

advancePos :: Pos -> Char -> Pos Source #

Advance a position by a single character. Newlines increment the line number, tabs increase the position column following a tab stop width of 8, and all other characters increase the position column by one. All characters, including newlines and tabs, increase the character offset by 1.

Note that advancePos assumes UNIX-style newlines.

displayPos :: Pos -> String Source #

Format a position in a human-readable way, returning an ordinary String.

displaySPos :: Pos -> ShowS Source #

Format a position in a human-readable way.

data Loc Source #

Location type, consisting of a beginning position and an end position.

Constructors

NoLoc 
Loc !Pos !Pos

Beginning and end positions

Instances

Instances details
Data Loc Source # 
Instance details

Defined in Data.Loc

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Loc -> c Loc Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Loc Source #

toConstr :: Loc -> Constr Source #

dataTypeOf :: Loc -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Loc) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Loc) Source #

gmapT :: (forall b. Data b => b -> b) -> Loc -> Loc Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Loc -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Loc -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Loc -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Loc -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Loc -> m Loc Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Loc -> m Loc Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Loc -> m Loc Source #

Monoid Loc Source # 
Instance details

Defined in Data.Loc

Semigroup Loc Source # 
Instance details

Defined in Data.Loc

Methods

(<>) :: Loc -> Loc -> Loc Source #

sconcat :: NonEmpty Loc -> Loc Source #

stimes :: Integral b => b -> Loc -> Loc Source #

Read Loc Source # 
Instance details

Defined in Data.Loc

Show Loc Source # 
Instance details

Defined in Data.Loc

Eq Loc Source # 
Instance details

Defined in Data.Loc

Methods

(==) :: Loc -> Loc -> Bool Source #

(/=) :: Loc -> Loc -> Bool Source #

Ord Loc Source # 
Instance details

Defined in Data.Loc

Methods

compare :: Loc -> Loc -> Ordering Source #

(<) :: Loc -> Loc -> Bool Source #

(<=) :: Loc -> Loc -> Bool Source #

(>) :: Loc -> Loc -> Bool Source #

(>=) :: Loc -> Loc -> Bool Source #

max :: Loc -> Loc -> Loc Source #

min :: Loc -> Loc -> Loc Source #

IsLocation Loc Source # 
Instance details

Defined in Data.Loc

Methods

fromLoc :: Loc -> Loc Source #

fromPos :: Pos -> Loc Source #

Located Loc Source # 
Instance details

Defined in Data.Loc

Methods

locOf :: Loc -> Loc Source #

locOfList :: [Loc] -> Loc Source #

locStart :: Loc -> Loc Source #

Starting position of the location.

locEnd :: Loc -> Loc Source #

Ending position of the location.

(<-->) :: (Located a, Located b) => a -> b -> Loc infixl 6 Source #

Merge the locations of two Located values.

displayLoc :: Loc -> String Source #

Format a location in a human-readable way, returning an ordinary String.

displaySLoc :: Loc -> ShowS Source #

Format a location in a human-readable way.

newtype SrcLoc Source #

Source location type. Source location are all equal, which allows AST nodes to be compared modulo location information.

Constructors

SrcLoc Loc 

Instances

Instances details
Data SrcLoc Source # 
Instance details

Defined in Data.Loc

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SrcLoc -> c SrcLoc Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SrcLoc Source #

toConstr :: SrcLoc -> Constr Source #

dataTypeOf :: SrcLoc -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SrcLoc) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SrcLoc) Source #

gmapT :: (forall b. Data b => b -> b) -> SrcLoc -> SrcLoc Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SrcLoc -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SrcLoc -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> SrcLoc -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SrcLoc -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc Source #

Monoid SrcLoc Source # 
Instance details

Defined in Data.Loc

Semigroup SrcLoc Source # 
Instance details

Defined in Data.Loc

Read SrcLoc Source # 
Instance details

Defined in Data.Loc

Show SrcLoc Source # 
Instance details

Defined in Data.Loc

Eq SrcLoc Source # 
Instance details

Defined in Data.Loc

Ord SrcLoc Source # 
Instance details

Defined in Data.Loc

IsLocation SrcLoc Source # 
Instance details

Defined in Data.Loc

Located SrcLoc Source # 
Instance details

Defined in Data.Loc

srclocOf :: Located a => a -> SrcLoc Source #

The SrcLoc of a Located value.

srcspan :: (Located a, Located b) => a -> b -> SrcLoc infixl 6 Source #

A SrcLoc with (minimal) span that includes two Located values.

class IsLocation a where Source #

Locations

Minimal complete definition

fromLoc

Methods

fromLoc :: Loc -> a Source #

fromPos :: Pos -> a Source #

Instances

Instances details
IsLocation Loc Source # 
Instance details

Defined in Data.Loc

Methods

fromLoc :: Loc -> Loc Source #

fromPos :: Pos -> Loc Source #

IsLocation SrcLoc Source # 
Instance details

Defined in Data.Loc

noLoc :: IsLocation a => a Source #

No location.

class Located a where Source #

Located values have a location.

Minimal complete definition

locOf

Methods

locOf :: a -> Loc Source #

locOfList :: [a] -> Loc Source #

Instances

Instances details
Located Loc Source # 
Instance details

Defined in Data.Loc

Methods

locOf :: Loc -> Loc Source #

locOfList :: [Loc] -> Loc Source #

Located Pos Source # 
Instance details

Defined in Data.Loc

Methods

locOf :: Pos -> Loc Source #

locOfList :: [Pos] -> Loc Source #

Located SrcLoc Source # 
Instance details

Defined in Data.Loc

Located (L a) Source # 
Instance details

Defined in Data.Loc

Methods

locOf :: L a -> Loc Source #

locOfList :: [L a] -> Loc Source #

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

Defined in Data.Loc

Methods

locOf :: Maybe a -> Loc Source #

locOfList :: [Maybe a] -> Loc Source #

Located a => Located [a] Source # 
Instance details

Defined in Data.Loc

Methods

locOf :: [a] -> Loc Source #

locOfList :: [[a]] -> Loc Source #

class Relocatable a where Source #

Values that can be relocated

Methods

reloc :: Loc -> a -> a Source #

Instances

Instances details
Relocatable (L a) Source # 
Instance details

Defined in Data.Loc

Methods

reloc :: Loc -> L a -> L a Source #

data L a Source #

A value of type L a is a value of type a with an associated Loc, but this location is ignored when performing comparisons.

Constructors

L Loc a 

Instances

Instances details
Functor L Source # 
Instance details

Defined in Data.Loc

Methods

fmap :: (a -> b) -> L a -> L b Source #

(<$) :: a -> L b -> L a Source #

Data a => Data (L a) Source # 
Instance details

Defined in Data.Loc

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> L a -> c (L a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (L a) Source #

toConstr :: L a -> Constr Source #

dataTypeOf :: L a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (L a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (L a)) Source #

gmapT :: (forall b. Data b => b -> b) -> L a -> L a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> L a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> L a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> L a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> L a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> L a -> m (L a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> L a -> m (L a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> L a -> m (L a) Source #

Show x => Show (L x) Source # 
Instance details

Defined in Data.Loc

Methods

showsPrec :: Int -> L x -> ShowS Source #

show :: L x -> String Source #

showList :: [L x] -> ShowS Source #

Eq x => Eq (L x) Source # 
Instance details

Defined in Data.Loc

Methods

(==) :: L x -> L x -> Bool Source #

(/=) :: L x -> L x -> Bool Source #

Ord x => Ord (L x) Source # 
Instance details

Defined in Data.Loc

Methods

compare :: L x -> L x -> Ordering Source #

(<) :: L x -> L x -> Bool Source #

(<=) :: L x -> L x -> Bool Source #

(>) :: L x -> L x -> Bool Source #

(>=) :: L x -> L x -> Bool Source #

max :: L x -> L x -> L x Source #

min :: L x -> L x -> L x Source #

Located (L a) Source # 
Instance details

Defined in Data.Loc

Methods

locOf :: L a -> Loc Source #

locOfList :: [L a] -> Loc Source #

Relocatable (L a) Source # 
Instance details

Defined in Data.Loc

Methods

reloc :: Loc -> L a -> L a Source #

unLoc :: L a -> a Source #