Well actually you can, with something like
{-
module T where
class C a
data X = X
data Y = Y
data Z = Z
$(fmap concat $ mapM (\t -> [d|instance C $t|]) [[t|X|], [t|Y|], [t|Z|]])
but it amazes me like mass enumeration if you really don't need to be automatically generated (for example, the list of types can change depending on something).
source
share