1
1
mirror of https://github.com/github/semantic.git synced 2025-01-05 14:11:33 +03:00

Move the ToJSONFields instance for Syntax into Syntax.

This commit is contained in:
Rob Rix 2017-09-09 17:25:55 +01:00
parent 4e3c34d8f7
commit 0845687d51
2 changed files with 5 additions and 4 deletions

View File

@ -23,7 +23,6 @@ import Diff
import GHC.Generics
import Info
import Language
import Syntax as S
import Term
--
@ -69,9 +68,6 @@ instance (ToJSONFields a, ToJSONFields (f b), ToJSONFields (f (Term f a))) => To
toJSONFields (Copy a f) = toJSONFields a <> toJSONFields f
toJSONFields (Patch a) = toJSONFields a
instance ToJSON recur => ToJSONFields (Syntax recur) where
toJSONFields syntax = [ "children" .= toList syntax ]
data File a = File { filePath :: FilePath, fileLanguage :: Maybe Language, fileContent :: a }
deriving (Generic, Show)

View File

@ -3,10 +3,12 @@ module Syntax where
import Data.Aeson
import Data.Align.Generic
import Data.Foldable (toList)
import Data.Functor.Classes
import Data.Functor.Classes.Eq.Generic
import Data.Functor.Classes.Pretty.Generic
import Data.Functor.Classes.Show.Generic
import Data.JSON.Fields
import Data.Mergeable
import Data.Text (Text)
import GHC.Generics
@ -123,3 +125,6 @@ extractLeafValue syntax = case syntax of
instance Eq1 Syntax where liftEq = genericLiftEq
instance Show1 Syntax where liftShowsPrec = genericLiftShowsPrec
instance Pretty1 Syntax where liftPretty = genericLiftPretty
instance ToJSON recur => ToJSONFields (Syntax recur) where
toJSONFields syntax = [ "children" .= toList syntax ]