I could open a PR for this, but I figured a discussion might be better first.
Right now there's no way to use aeson's faster toEncoding JSON serialization methods (if they're defined) with safe-json.
As far as I can tell, it should be possible to add support for this with a new method on SafeJSON where a -> Contained Encoding. It could be optional (like aeson), with the default implementation calling safeTo encoding the resulting Value.
It gets a bit tricky with something like .=$, though. I imagine we would need to define a SafeKeyValue class so that .=$ could use safeToJSON on Pair and Object types, but safeToEncoding (or whatever it might be called) on Series types.
I could open a PR for this, but I figured a discussion might be better first.
Right now there's no way to use
aeson's fastertoEncodingJSON serialization methods (if they're defined) withsafe-json.As far as I can tell, it should be possible to add support for this with a new method on
SafeJSONwherea -> Contained Encoding. It could be optional (likeaeson), with thedefaultimplementation callingsafeToencoding the resultingValue.It gets a bit tricky with something like
.=$, though. I imagine we would need to define aSafeKeyValueclass so that.=$could usesafeToJSONonPairandObjecttypes, butsafeToEncoding(or whatever it might be called) onSeriestypes.