1
1
mirror of https://github.com/github/semantic.git synced 2024-12-11 08:45:48 +03:00

Move the ToJSONFields instance for Range into Data.Range.

This commit is contained in:
Rob Rix 2017-09-09 17:19:46 +01:00
parent 62603c803c
commit 42c1795c0a
2 changed files with 6 additions and 3 deletions

View File

@ -6,6 +6,8 @@ module Data.Range
, intersectsRange
) where
import Data.Aeson
import Data.JSON.Fields
import Data.Semigroup
import Data.Text.Prettyprint.Doc
import GHC.Generics
@ -37,3 +39,7 @@ instance Ord Range where
instance Pretty Range where
pretty (Range from to) = pretty from <> pretty '-' <> pretty to
instance ToJSONFields Range where
toJSONFields Range{..} = ["sourceRange" .= [ start, end ]]

View File

@ -56,9 +56,6 @@ instance (ToJSONFields a, ToJSONFields (f (Term f a))) => ToJSON (Term f a) wher
toJSON = object . toJSONFields
toEncoding = pairs . mconcat . toJSONFields
instance ToJSONFields Range where
toJSONFields Range{..} = ["sourceRange" .= [ start, end ]]
instance ToJSONFields Category where
toJSONFields c = ["category" .= case c of { Other s -> s ; _ -> pack (show c) }]