mirror of
https://github.com/github/semantic.git
synced 2024-12-25 07:55:12 +03:00
Move the ToJSONFields instance for Location into Data.JSON.Fields.
This commit is contained in:
parent
ddef7139f6
commit
81f43c9881
@ -10,8 +10,7 @@ module Data.JSON.Fields
|
||||
|
||||
import Data.Aeson
|
||||
import qualified Data.Map as Map
|
||||
import Data.Range
|
||||
import Data.Span
|
||||
import Data.Location
|
||||
import Data.Sum (Apply (..), Sum)
|
||||
import qualified Data.Text as Text
|
||||
import GHC.Generics
|
||||
@ -54,6 +53,9 @@ instance ToJSONFields Range where
|
||||
instance ToJSONFields Span where
|
||||
toJSONFields sourceSpan = [ "sourceSpan" .= sourceSpan ]
|
||||
|
||||
instance ToJSONFields Location where
|
||||
toJSONFields Location{..} = toJSONFields locationByteRange <> toJSONFields locationSpan
|
||||
|
||||
|
||||
newtype JSONFields a = JSONFields { unJSONFields :: a }
|
||||
|
||||
|
@ -9,7 +9,6 @@ module Data.Location
|
||||
import Prologue
|
||||
|
||||
import Control.Lens.Lens
|
||||
import Data.JSON.Fields
|
||||
import Data.Range
|
||||
import Data.Span
|
||||
|
||||
@ -24,6 +23,3 @@ data Location
|
||||
instance HasSpan Location where
|
||||
span = lens locationSpan (\l s -> l { locationSpan = s })
|
||||
{-# INLINE span #-}
|
||||
|
||||
instance ToJSONFields Location where
|
||||
toJSONFields Location{..} = toJSONFields locationByteRange <> toJSONFields locationSpan
|
||||
|
Loading…
Reference in New Issue
Block a user