From 307919760c58e037ec3260fcd0c3c7f7227fd7aa Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Mon, 26 Feb 2024 22:59:54 +0100 Subject: WIP typecheck and other stuff --- src/HSVIS/Diagnostic.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/HSVIS/Diagnostic.hs') 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 -- cgit v1.2.3-70-g09d2