srcloc-0.3.0: Data types for managing source code locations.

Maintainermainland@eecs.harvard.edu
Safe HaskellNone

Data.Loc

Description

 

Synopsis

Documentation

data Pos Source

Position type.

Constructors

Pos !String !Int !Int !Int

Source file name, line, column, and character offset

posFile :: Pos -> StringSource

Position file.

posLine :: Pos -> IntSource

Position line.

posCol :: Pos -> IntSource

Position column.

posCoff :: Pos -> IntSource

Position character offset.

data Loc Source

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

Constructors

NoLoc 
Loc !Pos !Pos

Beginning and end positions

locStart :: Loc -> LocSource

Starting position of the location.

locEnd :: Loc -> LocSource

Ending position of the location.

(<-->) :: (Located a, Located b) => a -> b -> LocSource

Merge the locations of two Located values.

newtype SrcLoc Source

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

Constructors

SrcLoc Loc 

srclocOf :: Located a => a -> SrcLocSource

The SrcLoc of a Located value.

srcspan :: (Located a, Located b) => a -> b -> SrcLocSource

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

class IsLocation a whereSource

Locations

Methods

fromLoc :: Loc -> aSource

fromPos :: Pos -> aSource

noLoc :: IsLocation a => aSource

No location.

class Located a whereSource

Located values have a location.

Methods

locOf :: a -> LocSource

locOfList :: [a] -> LocSource

Instances

class Relocatable a whereSource

Values that can be relocated

Methods

reloc :: Loc -> a -> aSource

Instances

data L a Source

An 'L a' is an a with an associated Loc, but this location is ignored when performing comparisons.

Constructors

L Loc a 

Instances

Eq x => Eq (L x) 
(Eq (L x), Ord x) => Ord (L x) 
Show x => Show (L x) 
Relocatable (L a) 
Located (L a) 

unLoc :: L a -> aSource