expandableAlt

This commit is contained in:
crumbtoo
2024-02-06 10:52:01 -07:00
parent 4f9f00dfee
commit bd55efc5ed
5 changed files with 63 additions and 16 deletions

View File

@@ -2,6 +2,7 @@ module Compiler.Types
( SrcSpan(..)
, srcspanLine, srcspanColumn, srcspanAbs, srcspanLen
, Located(..)
, locating
, nolo
, (<<~), (<~>)
@@ -57,6 +58,9 @@ srcspanLen = tupling . _4
nolo :: a -> Located a
nolo = Located (SrcSpan 0 0 0 0)
locating :: Lens (Located a) (Located b) a b
locating = lens extract ($>)
instance Semigroup SrcSpan where
SrcSpan la ca aa sa <> SrcSpan lb cb ab sb = SrcSpan l c a s where
l = min la lb