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:
parent
4e3c34d8f7
commit
0845687d51
@ -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)
|
||||
|
||||
|
@ -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 ]
|
||||
|
Loading…
Reference in New Issue
Block a user