File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -67,3 +67,11 @@ source-repository-package
6767 --sha256 : WFEmGcnCdEXmo2MCC5g+C3laGjFaBnFksgHbFeAZUQo=
6868 subdir :
6969 generated
70+
71+ source-repository-package
72+ type : git
73+ location : https://github.com/well-typed/cborg.git
74+ tag : 7a4feb69bbbc09b0b29ed41ff3b9b8526e349c62
75+ --sha256 : 1YE6LP4YZNATEOfZ+/USDx/sIOi9rFbHmHVn6ONDrTc=
76+ subdir :
77+ cborg-json
Original file line number Diff line number Diff line change @@ -144,10 +144,9 @@ decodeJSONL = mapMaybe decode . BSL8.lines
144144encodeJSONL :: [TraceEvent ] -> BSL8. ByteString
145145encodeJSONL = BSL8. unlines . map encode
146146
147- -- | Throws exception on CBOR decoding errors, skips values that do not decode as TraceEvent.
148- -- WARNING: seems not to be compatible with CBOR format produced by rust-sim.
149- decodeCBOR :: BSL8. ByteString -> [TraceEvent ]
150- decodeCBOR = go
147+ -- | Generic version of @decodeCBOR@
148+ decodeCBORJSON :: FromJSON a => BSL8. ByteString -> [a ]
149+ decodeCBORJSON = go
151150 where
152151 go s | BSL8. null s = []
153152 go s =
@@ -157,6 +156,11 @@ decodeCBOR = go
157156 Success x -> x : go s'
158157 Error _ -> go s'
159158
159+ -- | Throws exception on CBOR decoding errors, skips values that do not decode as TraceEvent.
160+ -- WARNING: seems not to be compatible with CBOR format produced by rust-sim.
161+ decodeCBOR :: BSL8. ByteString -> [TraceEvent ]
162+ decodeCBOR = decodeCBORJSON
163+
160164-- | Uses standard CBOR encoding of JSON values, encoded events are concatenated with no separator.
161165encodeCBOR :: [TraceEvent ] -> BSL8. ByteString
162166encodeCBOR = BSL8. concat . map (toLazyByteString . encodeValue . toJSON)
You can’t perform that action at this time.
0 commit comments