1
1
mirror of https://github.com/github/semantic.git synced 2025-01-02 20:41:38 +03:00

Customize the Show instance for Pos for brevity.

This commit is contained in:
Rob Rix 2018-05-15 17:51:56 -04:00
parent f8c12cb213
commit 65d2fb968c

View File

@ -22,7 +22,7 @@ data Pos = Pos
{ posLine :: !Int
, posColumn :: !Int
}
deriving (Show, Eq, Ord)
deriving (Eq, Ord)
instance A.ToJSON Pos where
toJSON Pos{..} =
@ -33,6 +33,10 @@ instance A.FromJSON Pos where
[line, col] <- A.parseJSON arr
pure $ Pos line col
instance Show Pos where
showsPrec d Pos{..} = showsBinaryWith showsPrec showsPrec "Pos" d posLine posColumn
data Span = Span
{ spanStart :: Pos
, spanEnd :: Pos