This commit is contained in:
crumbtoo
2024-02-04 20:52:23 -07:00
parent b84992787c
commit 4f9f00dfee
2 changed files with 25 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ module Compiler.Types
( SrcSpan(..)
, srcspanLine, srcspanColumn, srcspanAbs, srcspanLen
, Located(..)
, nolo
, (<<~), (<~>)
-- * Re-exports
@@ -52,6 +53,10 @@ srcspanColumn = tupling . _2
srcspanAbs = tupling . _3
srcspanLen = tupling . _4
-- | debug tool
nolo :: a -> Located a
nolo = Located (SrcSpan 0 0 0 0)
instance Semigroup SrcSpan where
SrcSpan la ca aa sa <> SrcSpan lb cb ab sb = SrcSpan l c a s where
l = min la lb