[Haskell-beginners] questions about product types
byorgey at seas.upenn.edu
Sun Jan 8 20:43:48 CET 2012
On Fri, Jan 06, 2012 at 09:28:21PM +0000, Tom Doris wrote:
> My questions are:
> 1) I presume this approach has been explored and probably there is a well
> thought through library of helper classes and functions already out there,
> can someone please point me to it?
One package which I think is similar is
> 2) I don't know much about Haskell generics, but for product types in which
> all contained values are distinct types, it should be possible to
> automatically derive instances of Extract, since there's never ambiguity as
> to which field you want from a container if you've specified the type of
> value you want, is this possible, and if so does it already exist?
It's easy to extract a field of a certain type using a generic
traversal (of the sort found in packages like uniplate or syb). To
automatically derive instances of Extract I think you would have to
use Template Haskell.
> 3) In type theory, are product types consisting of distinct member types
> considered special in any way? i.e. does the concept have a name and what
> special properties do they have?
Not that I know of.
More information about the Beginners