I am attempting to use Data.Aeson.TH deriveJSON to generate the ToJSON and FromJSON instances for MongoDB Data.Bson.
At the moment I am using:
$(deriveJSON id ''Data.Bson.Field)
$(deriveJSON id ''Data.Bson.Value)
$(deriveJSON id ''Data.Bson.Binary)
$(deriveJSON id ''Data.Bson.UUID)
$(deriveJSON id ''Data.Bson.UserDefined)
$(deriveJSON id ''Data.Bson.Regex)
$(deriveJSON id ''Data.Bson.Symbol)
$(deriveJSON id ''Data.Bson.MinMaxKey)
$(deriveJSON id ''Data.Bson.MongoStamp)
$(deriveJSON id ''Data.Bson.Javascript)
$(deriveJSON id ''Data.Bson.ObjectId)
$(deriveJSON id ''Data.Bson.MD5)
$(deriveJSON id ''Data.Bson.Function)
$(deriveJSON id ''Data.Bson.UString)
Which generates the following error at compile time:
Exception when trying to run compile-time code:
Data.Aeson.TH.withType: Unsupported type: TySynD Data.UString.UString [] (ConT Data.CompactString.UTF8.CompactString)
Code: deriveJSON (id) 'UString
I think the issue here is that the string inside the BSON document is a Ustring. I need to convert or otherwise map the the UString expected within the BSON data to another String type ... but stumped as to how.