Turn tuples into syntactic sugar for heterogeneous lists
|Reported by:||benja.fallenstein@…||Owned by:|
|Keywords:||Cc:||pho@…, merehap@…, gtener@…, p.balzarek@…|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||Differential Rev(s):|
It would be nice if (x,y,z) were syntactic sugar for a heterogeneous list, i.e. (x :*: y :*: z :*: HNil) where
data a :*: b = a :*: b data HNil = HNil
(:*: associating to the right). Using functional dependencies and the techniques from the HList paper, we could then process tuples of arbitrary length in a uniform matter: for example, the Data.Monoid.Monoid instances for tuples. At the same time, this would create a slightly more light-weight syntax for heterogeneous lists, making them more acceptable for use cases like functions with optional or keyword arguments.
I'm not sure how much existing code would this would break. Showing and reading heterogeneous lists as tuples doesn't seem hard to implement. I don't know about Typeable and friends.