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

Maintainermainland@eecs.harvard.edu
Safe HaskellSafe-Infered

Data.Loc

Description

 

Synopsis

Documentation

data Pos Source

Position type.

Constructors

Pos !Symbol !Int !Int !Int

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.

noLoc :: Location a => aSource

No location.

newtype SrcLoc Source

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

Constructors

SrcLoc Loc 

locOf :: (Located a, Location b) => a -> bSource

(<-->) :: (Located a, Located b, Location c) => a -> b -> cSource

class Location a whereSource

Locations

Methods

fromLoc :: Loc -> aSource

class Located a whereSource

Located values have a location.

Methods

getLoc :: a -> LocSource

Instances

class Relocatable a whereSource

Values that can be relocated

Methods

reloc :: Located b => b -> a -> aSource

data L x Source

Locations are ignored when performing comparisons.

Constructors

L Loc x 

Instances

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

unLoc :: L a -> aSource