mirror of
https://github.com/github/semantic.git
synced 2024-12-26 00:12:29 +03:00
Construct Values from Terms using termFields.
This commit is contained in:
parent
60e0ca3337
commit
526c9ba26f
@ -56,7 +56,7 @@ instance (ToJSON recur) => ToJSON (Syntax leaf recur) where
|
||||
toJSON (Fixed c) = object [ "type" .= String "fixed", "children" .= Array (fromList $ toJSON <$> c) ]
|
||||
toJSON (Keyed c) = object [ "type" .= String "fixed", "children" .= object (uncurry (.=) <$> toList c) ]
|
||||
instance ToJSON (Term leaf Info) where
|
||||
toJSON (Info range categories :< syntax) = object [ "range" .= toJSON range, "categories" .= toJSON categories, "syntax" .= toJSON syntax ]
|
||||
toJSON (info :< syntax) = object (termFields info syntax)
|
||||
toEncoding (info :< syntax) = pairs (termSeries info syntax)
|
||||
|
||||
termSeries :: ToJSON recur => Info -> Syntax leaf recur -> Series
|
||||
|
Loading…
Reference in New Issue
Block a user