-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Data types for managing source code locations. -- -- Data types for tracking, combining, and printing source code -- locations. @package srcloc @version 0.6 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 infixl 6 <--> -- | 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 infixl 6 `srcspan` -- | Locations class IsLocation a fromLoc :: IsLocation a => Loc -> a fromPos :: IsLocation a => Pos -> a -- | No location. noLoc :: IsLocation a => a -- | Located values have a location. class Located a 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 Data.Data.Data Data.Loc.Pos instance GHC.Show.Show Data.Loc.Pos instance GHC.Read.Read Data.Loc.Pos instance GHC.Classes.Eq Data.Loc.Pos instance Data.Data.Data Data.Loc.Loc instance GHC.Show.Show Data.Loc.Loc instance GHC.Read.Read Data.Loc.Loc instance GHC.Classes.Ord Data.Loc.Loc instance GHC.Classes.Eq Data.Loc.Loc instance Data.Data.Data Data.Loc.SrcLoc instance Data.Data.Data a => Data.Data.Data (Data.Loc.L a) instance GHC.Base.Functor Data.Loc.L instance GHC.Classes.Eq x => GHC.Classes.Eq (Data.Loc.L x) instance GHC.Classes.Ord x => GHC.Classes.Ord (Data.Loc.L x) instance GHC.Show.Show x => GHC.Show.Show (Data.Loc.L x) instance Data.Loc.Located (Data.Loc.L a) instance Data.Loc.Relocatable (Data.Loc.L a) instance Data.Loc.Located a => Data.Loc.Located [a] instance Data.Loc.Located a => Data.Loc.Located (GHC.Maybe.Maybe a) instance Data.Loc.Located Data.Loc.Pos instance Data.Loc.Located Data.Loc.Loc instance Data.Loc.Located Data.Loc.SrcLoc instance Data.Loc.IsLocation Data.Loc.Loc instance Data.Loc.IsLocation Data.Loc.SrcLoc instance GHC.Base.Monoid Data.Loc.SrcLoc instance GHC.Base.Semigroup Data.Loc.SrcLoc instance GHC.Classes.Eq Data.Loc.SrcLoc instance GHC.Classes.Ord Data.Loc.SrcLoc instance GHC.Show.Show Data.Loc.SrcLoc instance GHC.Read.Read Data.Loc.SrcLoc instance GHC.Base.Semigroup Data.Loc.Loc instance GHC.Base.Monoid Data.Loc.Loc instance GHC.Classes.Ord Data.Loc.Pos