loc-0.1.3.8: Types representing line and column positions and ranges in text files.

Safe HaskellNone
LanguageHaskell2010

Data.Loc.Loc

Contents

Synopsis

Documentation

data Loc Source #

Stands for location. Consists of a Line and a Column. You can think of a Loc like a caret position in a text editor. Following the normal convention for text editors and such, line and column numbers start with 1.

Instances
Eq Loc Source # 
Instance details

Defined in Data.Loc.Loc

Methods

(==) :: Loc -> Loc -> Bool #

(/=) :: Loc -> Loc -> Bool #

Ord Loc Source # 
Instance details

Defined in Data.Loc.Loc

Methods

compare :: Loc -> Loc -> Ordering #

(<) :: Loc -> Loc -> Bool #

(<=) :: Loc -> Loc -> Bool #

(>) :: Loc -> Loc -> Bool #

(>=) :: Loc -> Loc -> Bool #

max :: Loc -> Loc -> Loc #

min :: Loc -> Loc -> Loc #

Read Loc Source #

readPrec = locReadPrec

Instance details

Defined in Data.Loc.Loc

Show Loc Source #

showsPrec = locShowsPrec

Instance details

Defined in Data.Loc.Loc

Methods

showsPrec :: Int -> Loc -> ShowS #

show :: Loc -> String #

showList :: [Loc] -> ShowS #

Constructing

loc :: Line -> Column -> Loc Source #

Create a Loc from a line number and column number.

origin :: Loc Source #

The smallest location: loc 1 1.

>>> origin
1:1

Querying

Show and Read

locShowsPrec :: Int -> Loc -> ShowS Source #

>>> locShowsPrec minPrec (loc 3 14) ""
"3:14"

locReadPrec :: ReadPrec Loc Source #

>>> readPrec_to_S locReadPrec minPrec "3:14"
[(3:14,"")]