|
|
|
|
|
Description |
This module contains types that relate to the positions of things
in source files, and allow tagging of those things with locations
|
|
Synopsis |
|
|
|
|
SrcLoc
|
|
|
Represents a single point within a file
| Instances | |
|
|
Constructing SrcLoc
|
|
|
|
|
Creates a bad SrcLoc that has no detailed information about its location
|
|
|
|
|
Built-in bad SrcLoc values for particular locations
|
|
|
|
|
Move the SrcLoc down by one line if the character is a newline
and across by one character in any other case
|
|
Unsafely deconstructing SrcLoc
|
|
|
Gives the filename of the SrcLoc if it is available, otherwise returns a dummy value
|
|
|
Raises an error when used on a bad SrcLoc
|
|
|
Raises an error when used on a bad SrcLoc
|
|
Misc. operations on SrcLoc
|
|
|
Pretty prints information about the SrcSpan in the style defined at ...
|
|
Predicates on SrcLoc
|
|
|
Good SrcLocs have precise information about their location
|
|
SrcSpan
|
|
|
A SrcSpan delimits a portion of a text file. It could be represented
by a pair of (line,column) coordinates, but in fact we optimise
slightly by using more compact representations for single-line and
zero-length spans, both of which are quite common.
The end position is defined to be the column after the end of the
span. That is, a span of (1,1)-(1,2) is one character long, and a
span of (1,1)-(1,1) is zero characters long.
| Instances | |
|
|
Constructing SrcSpan
|
|
|
Create a bad SrcSpan that has not location information
|
|
|
Create a SrcSpan between two points in a file
|
|
|
|
|
Built-in bad SrcSpans for common sources of location uncertainty
|
|
|
Create a SrcSpan corresponding to a single point
|
|
|
Combines two SrcSpan into one that spans at least all the characters
within both spans. Assumes the file part is the same in both inputs
|
|
Deconstructing SrcSpan
|
|
|
Returns the location at the start of the SrcSpan or a bad SrcSpan if that is unavailable
|
|
|
Returns the location at the end of the SrcSpan or a bad SrcSpan if that is unavailable
|
|
|
Obtains the filename for a SrcSpan if it is good
|
|
Unsafely deconstructing SrcSpan
|
|
|
|
|
Raises an error when used on a bad SrcSpan
|
|
|
Raises an error when used on a bad SrcSpan
|
|
|
Raises an error when used on a bad SrcSpan
|
|
|
Raises an error when used on a bad SrcSpan
|
|
Predicates on SrcSpan
|
|
|
Test if a SrcSpan is good, i.e. has precise location information
|
|
|
True if the span is known to straddle only one line.
For bad SrcSpan, it returns False
|
|
Located
|
|
|
We attach SrcSpans to lots of things, so let's have a datatype for it.
| Constructors | | Instances | |
|
|
Constructing Located
|
|
|
|
|
|
Deconstructing Located
|
|
|
|
|
|
Combining and comparing Located values
|
|
|
Tests whether the two located things are equal
|
|
|
Tests the ordering of the two located things
|
|
|
|
|
Combine locations from two Located things and add them to a third thing
|
|
|
|
|
Alternative strategies for ordering SrcSpans
|
|
|
|
|
Determines whether a span encloses a given line and column index
|
|
|
:: SrcSpan | The span that may be enclosed by the other
| -> SrcSpan | The span it may be enclosed by
| -> Bool | | Determines whether a span is enclosed by another one
|
|
|
Produced by Haddock version 2.6.1 |