mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
Define new Show instance for BaseError
This commit is contained in:
parent
2468123252
commit
fdd6ea9344
@ -14,6 +14,14 @@ import Prologue
|
||||
|
||||
data BaseError (exc :: * -> *) resume = BaseError { baseErrorModuleInfo :: ModuleInfo, baseErrorSpan :: Span, baseErrorException :: exc resume }
|
||||
|
||||
instance (Show (exc resume)) => Show (BaseError exc resume) where
|
||||
showsPrec _ BaseError{..} = shows baseErrorException <> showString " " <> showString errorLocation
|
||||
where errorLocation | startErrorLine == endErrorLine = M.modulePath baseErrorModuleInfo <> " " <> startErrorLine <> ":" <> startErrorCol <> "-" <> endErrorCol
|
||||
| otherwise = M.modulePath baseErrorModuleInfo <> " " <> startErrorLine <> ":" <> startErrorCol <> "-" <> endErrorLine <> ":" <> endErrorCol
|
||||
startErrorLine = show $ S.posLine (S.spanStart baseErrorSpan)
|
||||
endErrorLine = show $ S.posLine (S.spanEnd baseErrorSpan)
|
||||
startErrorCol = show $ S.posColumn (S.spanStart baseErrorSpan)
|
||||
endErrorCol = show $ S.posColumn (S.spanEnd baseErrorSpan)
|
||||
|
||||
instance (Eq1 exc) => Eq1 (BaseError exc) where
|
||||
liftEq f (BaseError _ _ exc1) (BaseError _ _ exc2) = liftEq f exc1 exc2
|
||||
|
Loading…
Reference in New Issue
Block a user