Open amnaredo opened 3 years ago
Possible. Would require some thought as to how to make it work well. Not sure whether typeclasses or virtual-classes would be the way to go for this
Original Author: lihaoyi
Here's my first attempt: https://github.com/tindzk/upickle/tree/change-sumencoding
It doesn't work as expected since the implicit is not resolved properly. Do you have any idea how to fix it?
Edit: The fix was simple: The case object
needed to be flagged with implicit
.
Original Author: tindzk
This is fixed in master https://github.com/lihaoyi/upickle-pprint/blob/master/upickle/shared/src/main/scala/upickle/Api.scala#L7-L40
Now you can define your own upickle bundle and override the CaseR/CaseW sum encoding, swap between the old array-wrapped typetags and type-attribute typetags, and other things. By default I provide import upickle.legacy._
for the old encoding and upickle.default
for a seemingly much-more-useful default encoding
Original Author: lihaoyi
Great, thanks!
Original Author: tindzk
I need to parse the Pandoc format which is produced via aeson. aeson supports configuring the sum encoding which is done as follows in Pandoc:
Obviously, this consumes more space than the current approach chosen by uPickle:
Would it be possible to not import
annotate
by default, so that I could define it manually?This feature would significantly increase interoperability with other picklers as there doesn't seem to be a common standard on how to serialise classes.
ID: 55 Original Author: tindzk