tempus-0.1.0: Tempus/Loc.hs
-- | Support for source locations.
module Tempus.Loc (
SrcLoc,
showSrcLoc,
Loc (..),
unLoc
) where
-- | A source location, where the first value indicates the line and the second the column number
type SrcLoc = (Int, Int)
-- | Converts a source location to a string.
showSrcLoc :: SrcLoc -> String
showSrcLoc (l, c) = concat [show l, ":", show c]
-- | A value together with a source location.
data Loc a = Loc SrcLoc a deriving (Show, Eq)
-- | Unwraps the value and discards the location.
unLoc :: Loc a -> a
unLoc (Loc _ a) = a