It's not that hard to write ToJSON/FromJSON instances for the generated types but still, while you're generating code could you throw that in? Or is there an easy way to make this happen as a Yesod user? (I haven't dug too deep into how TH works...)
Update: OK, I like this suggestion but, say my persistent type is User. If I use
$(deriveJSON id ''User)
it yields
Exception when trying to run compile-time code:
Data.Aeson.TH.withType: Unsupported type: TySynD Model.User [] (AppT (ConT Model.UserGeneric) (ConT Database.Persist.GenericSql.Raw.SqlPersist))
Code: deriveJSON (id) 'User
apparently because it's an alias. But
$(deriveJSON id ''UserGeneric)
yields
Kind mis-match
The first argument of `UserGeneric' should have kind `(* -> *)
-> *
-> *',
but `backend[i5XB]' has kind `*'
I've probably still got the wrong type but I can't find enough about what Persistent generates to get the right incantation.