aboutsummaryrefslogtreecommitdiff
path: root/src/HSVIS/Diagnostic.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-02-26 22:59:54 +0100
committerTom Smeding <tom@tomsmeding.com>2024-02-26 22:59:54 +0100
commit307919760c58e037ec3260fcd0c3c7f7227fd7aa (patch)
tree2d4451b230a243f4dec60d80b6e9557c2e486749 /src/HSVIS/Diagnostic.hs
parent49f4a26867eb81eb59cfea78374bb09dd45edfa3 (diff)
WIP typecheck and other stuff
Diffstat (limited to 'src/HSVIS/Diagnostic.hs')
-rw-r--r--src/HSVIS/Diagnostic.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/HSVIS/Diagnostic.hs b/src/HSVIS/Diagnostic.hs
index 75a677f..322f9eb 100644
--- a/src/HSVIS/Diagnostic.hs
+++ b/src/HSVIS/Diagnostic.hs
@@ -7,12 +7,15 @@ data Pos = Pos
{ posLine :: Int -- ^ zero-based
, posCol :: Int -- ^ zero-based
}
- deriving (Show)
+ deriving (Show, Eq, Ord)
-- | Inclusive-exclusive range of positions in a file.
data Range = Range Pos Pos
deriving (Show)
+instance Semigroup Range where
+ Range a b <> Range c d = Range (min a c) (max b d)
+
data Diagnostic = Diagnostic
{ dFile :: FilePath -- ^ The file for which the diagnostic was raised
, dRange :: Range -- ^ Where in the file