sigh i'm gonna have to nuke the ast again in a month

This commit is contained in:
crumbtoo
2024-02-07 18:52:19 -07:00
parent 2a51daf356
commit 80425a274c
5 changed files with 36 additions and 14 deletions

View File

@@ -1,8 +1,9 @@
{-# LANGUAGE TemplateHaskell #-}
module Compiler.Types
( SrcSpan(..)
, srcspanLine, srcspanColumn, srcspanAbs, srcspanLen
, Located(..)
, locating
, _Located
, nolo
, (<<~), (<~>), (<#>)
@@ -58,9 +59,6 @@ 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
@@ -93,3 +91,5 @@ fab <#> a = fmap ($ a) fab
infixl 4 <#>
makePrisms ''Located