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:
parent
62603c803c
commit
42c1795c0a
@ -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 ]]
|
||||
|
@ -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) }]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user