I'm trying to implement conversion to YAML for Generic types.
The simple conversion I implemented works well, but I would like to use their Show instance for the types like data Foo = Bar | Biz.
I was thinking of something like bellow. It correctly catches the types mentioned above, but fails on invoking the show as I'm not able to properly constraint it.
instance {-# OVERLAPPING #-} (GToYaml x, GToYaml y) => GToYaml (D1 d (x :+: y)) where
gToYaml x = string $ pack $ show $ to x
Is it possible to somehow constraint for original type to have Generic and Show instances? Or it should be handled somehow differently?