diff options
Diffstat (limited to 'src/HSVIS/Diagnostic.hs')
-rw-r--r-- | src/HSVIS/Diagnostic.hs | 5 |
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 |