| Copyright | (c) Hangil Kim 2026 Kairon Johnson 2026 Leonidas Sallos 2026 Oscar Abelanet 2026 |
|---|---|
| License | MIT |
| Maintainer | kimhang@oregonstate.edu |
| Stability | experimental |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
LH.Data.SrcLoc
Description
Source positions
Source spans
A set of contiguous positions in the source.
A span can simply be described as the interval \([a,b)\), where \(a\) and \(b\) have type LHsPos.
Constructors
| LHsSpan | |
Lexemes
A token paired with its span in the source.
Joining spans
(><) :: (Spannable a, Spannable b) => a -> b -> LHsSpan infixl 3 Source #
Produces a span starting at the first argument and ending at the second argument.
\([a,b)\mathbin{\texttt{><}}[c,d)=[a,d)\)
(><*) :: (Spannable a, Spannable b) => a -> Seq b -> LHsSpan infixl 4 Source #
Produces a span starting at the first argument all the way to the end of the last element of the second argument.
can be interpreted as applying (><*) zero or more times.(><)
\([a,b)\mathbin{\texttt{><}^*}\texttt{[}[c_1,d_1)\texttt{,}\ldots\texttt{,}[c_n,d_n)\texttt{]}=[a,b)\mathbin{\texttt{><}}[c_1,d_1)\mathbin{\texttt{><}}\ldots\mathbin{\texttt{><}}[c_n,d_n)=[a,d_n)\)
Located values
A value paired with its span in the source.
L allows any language construct to be paired with a span, e.g., declarations, expressions, types, and patterns.
Error messages can then reference loc for pointing to appropriate places in the source.