title: How to serialize a data structure which is instance of Data?
body: <p>I want to serialize a data structure which is partially defined by my own, and partially is using data structures that come from an external library (which is an instance of Data). I wanted to do the serialization without having to define how the serialization process should work, or in other words, in a rather automatic way.</p>
  
  <p>I've been trying several alternatives I've found by googling/asking. None of them was successful. Library (<a href="https://hackage.haskell.org/package/genericserialize" rel="nofollow">genericserialize</a>) seemed what I was looking for. Unfortunately, it does not work even for simple cases (like (True, False)). It is probably outdated or/and incomplete. Binary serialization requires that the external data structure derives Binary (which it does not). With <a href="https://hackage.haskell.org/package/cereal" rel="nofollow">Cereal</a> similar problems arise. Of course, it is Read/Show, but again, the external data structure does not derive Read, so it neither can be used.</p>
  
  <p>Maybe I'm misunderstanding something. I thought when I first faced this problem it would be easier. In other languages, like Erlang for instance, this is done in a very simple way. </p>
  
  <p>Do you know libraries/techniques or whatever to make this process as simple as possible? </p>