I'd like to store aeson Values usig acid-store. I've taken a minimal acid implementation and tried to naively switch the types over to Value. These are my calls to deriveSafeCopy:
$(deriveSafeCopy 0 'base ''Object)
$(deriveSafeCopy 0 'base ''Array)
$(deriveSafeCopy 0 'base ''Number)
$(deriveSafeCopy 0 'base ''Value)
$(deriveSafeCopy 0 'base ''JSONState)
$(deriveSafeCopy 0 'base ''JSONStateStore)
JSONState and JSONStateStore are my own types. I get this error:
Can't derive SafeCopy instance for: (Data.Aeson.Types.Internal.Object,TyConI (TySynD Data.Aeson.Types.Internal.Object [] (AppT (AppT (ConT Data.HashMap.Base.HashMap) (ConT Data.Text.Internal.Text)) (ConT Data.Aeson.Types.Internal.Value))))
Evidently you've reached a limit of what the deriveSafeCopy
Template Haskell function can do for you.
You can solve the issue by providing the instances manually. SafeCopy API contains comprehensive docs on how to do that. For additional examples you can check out how the default instances are declared.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With