-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Data types for managing source code locations.
--
@package srcloc
@version 0.5.0
module Data.Loc
-- | Position type.
data Pos
-- | Source file name, line, column, and character offset.
--
-- Line numbering starts at 1, column offset starts at 1, and character
-- offset starts at 0.
Pos :: !FilePath -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> Pos
-- | Position file.
posFile :: Pos -> FilePath
-- | Position line.
posLine :: Pos -> Int
-- | Position column.
posCol :: Pos -> Int
-- | Position character offset.
posCoff :: Pos -> Int
-- | Starting position for given file.
startPos :: FilePath -> Pos
-- | Position corresponding to given file and line.
--
-- Note that the associated character offset is set to 0.
linePos :: FilePath -> Int -> Pos
-- | 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.
advancePos :: Pos -> Char -> Pos
-- | Format a position in a human-readable way, returning an ordinary
-- String.
displayPos :: Pos -> String
-- | Format a position in a human-readable way.
displaySPos :: Pos -> ShowS
-- | Location type, consisting of a beginning position and an end position.
data Loc
NoLoc :: Loc
-- | Beginning and end positions
Loc :: {-# UNPACK #-} !Pos -> {-# UNPACK #-} !Pos -> Loc
-- | Starting position of the location.
locStart :: Loc -> Loc
-- | Ending position of the location.
locEnd :: Loc -> Loc
-- | Merge the locations of two Located values.
(<-->) :: (Located a, Located b) => a -> b -> Loc
-- | Format a location in a human-readable way, returning an ordinary
-- String.
displayLoc :: Loc -> String
-- | Format a location in a human-readable way.
displaySLoc :: Loc -> ShowS
-- | Source location type. Source location are all equal, which allows AST
-- nodes to be compared modulo location information.
newtype SrcLoc
SrcLoc :: Loc -> SrcLoc
-- | The SrcLoc of a Located value.
srclocOf :: Located a => a -> SrcLoc
-- | A SrcLoc with (minimal) span that includes two Located
-- values.
srcspan :: (Located a, Located b) => a -> b -> SrcLoc
-- | Locations
class IsLocation a where fromPos p = fromLoc (Loc p p)
fromLoc :: IsLocation a => Loc -> a
fromPos :: IsLocation a => Pos -> a
-- | No location.
noLoc :: IsLocation a => a
-- | Located values have a location.
class Located a where locOfList xs = mconcat (map locOf xs)
locOf :: Located a => a -> Loc
locOfList :: Located a => [a] -> Loc
-- | Values that can be relocated
class Relocatable a
reloc :: Relocatable a => Loc -> a -> a
-- | A value of type L a is a value of type a with an
-- associated Loc, but this location is ignored when performing
-- comparisons.
data L a
L :: Loc -> a -> L a
unLoc :: L a -> a
instance Typeable Pos
instance Typeable Loc
instance Typeable SrcLoc
instance Eq Pos
instance Read Pos
instance Show Pos
instance Data Pos
instance Eq Loc
instance Read Loc
instance Show Loc
instance Data Loc
instance Data SrcLoc
instance Relocatable (L a)
instance Located (L a)
instance Show x => Show (L x)
instance Ord x => Ord (L x)
instance Eq x => Eq (L x)
instance Located SrcLoc
instance Located Loc
instance Located Pos
instance Located a => Located (Maybe a)
instance Located a => Located [a]
instance IsLocation SrcLoc
instance IsLocation Loc
instance Read SrcLoc
instance Show SrcLoc
instance Ord SrcLoc
instance Eq SrcLoc
instance Monoid Loc
instance Ord Pos