Having read about the SerTH library, I am now trying to use it in my
It works great for simple types. However, I ran into trouble when I tried
> data S = S (Map Int Int)
; ghc complains that there is no instance for 'Serializable (Data.Map.Map
Int Int)'. I am not sure how to derive such an instance. I tried
> $(deriveSerializable ''Map)
, which gave
"Exception when trying to run compile-time code:
patterns in function sdef".
Is this perhaps because 'deriveSerializable' cannot handle type constructors
Next I tried
> type MapIntInt = Map Int Int
> $(deriveSerializable ''MapIntInt)
, giving the same error message.
To investigate, I tried to serialise
> type Foo = Int
which did not work. However, it is possible to derive serialisation for
> data Bar = Bar Char Foo Int
with 'Foo' as above. So it seems that type synonyms can be serialised
indirectly, but not directly.
Could anyone give me a hint as to what I'm doing wrong? Or is what I'm
trying not possible with SerTH?