mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Make function formatting consistent in Renderer.JSON.hs
This commit is contained in:
parent
14fe319ade
commit
758b631ea7
@ -65,7 +65,11 @@ instance (ToJSON (Record fields), ToJSON leaf, HasField fields Category, HasFiel
|
||||
toEncoding term |
|
||||
(info :< syntax) <- runCofree term = pairs $ mconcat (termFields info syntax)
|
||||
|
||||
lineFields :: (ToJSON leaf, ToJSON (Record fields), HasField fields Category, HasField fields Range) => KeyValue kv => Int -> SplitSyntaxDiff leaf fields -> Range -> [kv]
|
||||
lineFields :: (ToJSON leaf, ToJSON (Record fields), HasField fields Category, HasField fields Range, KeyValue kv) =>
|
||||
Int ->
|
||||
SplitSyntaxDiff leaf fields ->
|
||||
Range ->
|
||||
[kv]
|
||||
lineFields n term range = [ "number" .= n
|
||||
, "terms" .= [ term ]
|
||||
, "range" .= range
|
||||
@ -78,7 +82,9 @@ termFields :: (ToJSON recur, KeyValue kv, HasField fields Category, HasField fie
|
||||
[kv]
|
||||
termFields info syntax = "range" .= characterRange info : "category" .= category info : syntaxToTermField syntax
|
||||
|
||||
patchFields :: (ToJSON (Record fields), ToJSON leaf, KeyValue kv, HasField fields Category, HasField fields Range) => SplitPatch (SyntaxTerm leaf fields) -> [kv]
|
||||
patchFields :: (ToJSON (Record fields), ToJSON leaf, KeyValue kv, HasField fields Category, HasField fields Range) =>
|
||||
SplitPatch (SyntaxTerm leaf fields) ->
|
||||
[kv]
|
||||
patchFields patch = case patch of
|
||||
SplitInsert term -> fields "insert" term
|
||||
SplitDelete term -> fields "delete" term
|
||||
@ -87,7 +93,9 @@ patchFields patch = case patch of
|
||||
fields kind term |
|
||||
(info :< syntax) <- runCofree term = "patch" .= T.pack kind : termFields info syntax
|
||||
|
||||
syntaxToTermField :: (ToJSON recur, KeyValue kv) => Syntax leaf recur -> [kv]
|
||||
syntaxToTermField :: (ToJSON recur, KeyValue kv) =>
|
||||
Syntax leaf recur ->
|
||||
[kv]
|
||||
syntaxToTermField syntax = case syntax of
|
||||
Leaf _ -> []
|
||||
Indexed c -> childrenFields c
|
||||
|
Loading…
Reference in New Issue
Block a user