
18 Feb
2016
18 Feb
'16
3:24 p.m.
GHC.Generics defines the following pleasantly-named types data (f :+: g) a = L1 (f a) | R1 (g a) and data (f :*: g) a = f a :*: g a represent lifted sums and products (analogous to Either and (,), respectively). These types, however, are given very few instances. Most notably, they lack even Functor instances! Entirely equivalent types, with less pleasant names, appear in transformers Data.Functor.Sum and Data.Functor.Product, where they are given plenty of instances. Is there some way to bring these things together, preferably with the names from GHC.Generics and the instances from Data.Functor.Sum and Data.Functor.Product?