Discussion: GHC.Generics vs. transformers Sum/Product

David Feuer david.feuer at gmail.com
Thu Feb 18 20:24:17 UTC 2016


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160218/77b362ad/attachment.html>


More information about the Libraries mailing list