mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Define an Output instance for JSONOutput.
This commit is contained in:
parent
e4ead782bc
commit
d1516c6f04
@ -14,7 +14,9 @@ import Data.Aeson as A
|
||||
import Data.JSON.Fields
|
||||
import Data.Blob
|
||||
import qualified Data.Map as Map
|
||||
import Data.ByteString.Lazy (toStrict)
|
||||
import qualified Data.Map.Monoidal as Monoidal
|
||||
import Data.Output
|
||||
import Data.Patch
|
||||
import Prologue
|
||||
|
||||
@ -25,6 +27,10 @@ toJSONOutput :: Text -> [Value] -> JSONOutput
|
||||
toJSONOutput key = JSONOutput . Monoidal.singleton key
|
||||
|
||||
|
||||
instance Output JSONOutput where
|
||||
toOutput = toStrict . encode . unJSONOutput
|
||||
|
||||
|
||||
-- | Render a diff to a value representing its JSON.
|
||||
renderJSONDiff :: ToJSON a => BlobPair -> a -> [Value]
|
||||
renderJSONDiff blobs diff = pure $
|
||||
|
Loading…
Reference in New Issue
Block a user