Manually Implement Serialize typelclass without Generic typeclass. (Cereal Library)
I am trying to serialize records that could not normally be serialized by using an extra record field. For example:
data Task where
Task :: (Serialize t) => {doThing :: IO (), represent :: t} -> Task
Then I would like to implement the Serialize interface by accessing the record's represent value. However this requires the Task type to be Generic which cannot be derived (in this case) and cannot be manually implemented.
For context record types of this form are being used like existential types (eg: handleAccountCreation :: User -> Task). Getting this to work for existential types could also work.
Posted Jan 29, 2025, 3:46 PM UTC
20