LayeredHaskell-0.1.0.0: A friendly layered implementation of a subset of Haskell.
Copyright(c) Hangil Kim 2026
Kairon Johnson 2026
Leonidas Sallos 2026
Oscar Abelanet 2026
LicenseMIT
Maintainerkimhang@oregonstate.edu
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

LH.Data.SrcLoc

Description

This module provides definitions for locations in the source. LHsPos indicates a single position, whereas LHsSpan indicates a set of positions.

Synopsis

Source positions

data LHsPos Source #

A position in the source.

Constructors

LHsPos 

Fields

Instances

Instances details
Show LHsPos Source # 
Instance details

Defined in LH.Data.SrcLoc

Eq LHsPos Source # 
Instance details

Defined in LH.Data.SrcLoc

Methods

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

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

Ord LHsPos Source # 
Instance details

Defined in LH.Data.SrcLoc

Source spans

data LHsSpan Source #

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 

Fields

Instances

Instances details
Spannable LHsSpan Source # 
Instance details

Defined in LH.Data.SrcLoc

Show LHsSpan Source # 
Instance details

Defined in LH.Data.SrcLoc

Eq LHsSpan Source # 
Instance details

Defined in LH.Data.SrcLoc

Methods

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

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

Lexemes

data LHsLexeme Source #

A token paired with its span in the source.

Constructors

LHsLexeme !LHsSpan !LHsToken 

Instances

Instances details
Spannable LHsLexeme Source # 
Instance details

Defined in LH.Data.SrcLoc

Show LHsLexeme Source # 
Instance details

Defined in LH.Data.SrcLoc

Eq LHsLexeme Source # 
Instance details

Defined in LH.Data.SrcLoc

Joining spans

class Spannable a where Source #

A Spannable type can be converted into a span via toSpan.

Methods

toSpan :: a -> LHsSpan Source #

Converts a value into a span.

Instances

Instances details
Spannable LHsLexeme Source # 
Instance details

Defined in LH.Data.SrcLoc

Spannable LHsSpan Source # 
Instance details

Defined in LH.Data.SrcLoc

Spannable (L a) Source # 
Instance details

Defined in LH.Data.SrcLoc

Methods

toSpan :: L a -> LHsSpan Source #

(><) :: (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

data L a Source #

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.

Constructors

L 

Fields

Instances

Instances details
Spannable (L a) Source # 
Instance details

Defined in LH.Data.SrcLoc

Methods

toSpan :: L a -> LHsSpan Source #

Show a => Show (L a) Source #

show (x :: L a) = show (un x).

Instance details

Defined in LH.Data.SrcLoc

Methods

showsPrec :: Int -> L a -> ShowS #

show :: L a -> String #

showList :: [L a] -> ShowS #

Eq a => Eq (L a) Source #

x :: L a == y :: L a \(\Longleftrightarrow\) un x == un y.

Instance details

Defined in LH.Data.SrcLoc

Methods

(==) :: L a -> L a -> Bool #

(/=) :: L a -> L a -> Bool #

Ord a => Ord (L a) Source #

compare (x :: L a) (y :: L a) \(\Longleftrightarrow\) compare (un x) (un y).

Instance details

Defined in LH.Data.SrcLoc

Methods

compare :: L a -> L a -> Ordering #

(<) :: L a -> L a -> Bool #

(<=) :: L a -> L a -> Bool #

(>) :: L a -> L a -> Bool #

(>=) :: L a -> L a -> Bool #

max :: L a -> L a -> L a #

min :: L a -> L a -> L a #