mirror of
https://github.com/github/semantic.git
synced 2024-12-30 18:36:27 +03:00
🔥 NumberedLine.
This commit is contained in:
parent
cbf17cdc22
commit
036e472aab
@ -31,16 +31,9 @@ json blobs diff = Map.fromList
|
||||
, ("paths", toJSON (path <$> blobs))
|
||||
]
|
||||
|
||||
-- | A numbered 'a'.
|
||||
newtype NumberedLine a = NumberedLine (Int, a)
|
||||
|
||||
instance StringConv (Map Text Value) ByteString where
|
||||
strConv _ = toS . (<> "\n") . encode
|
||||
|
||||
instance ToJSONFields a => ToJSON (NumberedLine a) where
|
||||
toJSON (NumberedLine (n, a)) = object $ "number" .= n : toJSONFields a
|
||||
toEncoding (NumberedLine (n, a)) = pairs $ "number" .= n <> mconcat (toJSONFields a)
|
||||
|
||||
instance ToJSON a => ToJSONFields (Join (,) a) where
|
||||
toJSONFields (Join (a, b)) = [ "before" .= a, "after" .= b ]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user