-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Data types for managing source code locations. -- -- Data types for managing source code locations. @package srcloc @version 0.1.1 module Data.Loc -- | Position type. data Pos -- | file name, line, column and character offset Pos :: !Symbol -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> Pos -- | Position file. posFile :: Pos -> String -- | Position line. posLine :: Pos -> Int -- | Position column. posCol :: Pos -> Int -- | Position character offset. posCoff :: Pos -> Int startPos :: String -> Pos linePos :: String -> Int -> Pos advancePos :: Pos -> Char -> Pos -- | 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 -- | No location. noLoc :: Location a => a -- | Source location type. Source location are all equal, which allows AST -- nodes to be compared modulo location information. newtype SrcLoc SrcLoc :: Loc -> SrcLoc noSrcLoc :: SrcLoc locOf :: (Located a, Location b) => a -> b (<-->) :: (Located a, Located b, Location c) => a -> b -> c mergeLoc :: Loc -> Loc -> Loc -- | Locations class Location a fromLoc :: Location a => Loc -> a -- | Located values have a location. class Located a getLoc :: Located a => a -> Loc -- | Values that can be relocated class Relocatable a reloc :: (Relocatable a, Located b) => b -> a -> a -- | Locations are ignored when performing comparisons. data L x L :: Loc -> x -> L x unLoc :: L a -> a instance Typeable Pos instance Typeable Loc instance Typeable SrcLoc instance Eq Pos instance Data Pos instance Eq Loc instance Data Loc instance Data SrcLoc instance Show x => Show (L x) instance Located (L a) 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 [a] instance Location SrcLoc instance Location Loc instance Ord SrcLoc instance Eq SrcLoc instance Ord Pos