[GHC] #1245: Turn tuples into syntactic sugar for heterogeneous
lists
GHC
trac at galois.com
Mon Mar 26 09:06:25 EDT 2007
#1245: Turn tuples into syntactic sugar for heterogeneous lists
--------------------------------------------+-------------------------------
Reporter: benja.fallenstein at gmail.com | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.6
Severity: normal | Keywords:
Difficulty: Unknown | Testcase:
Architecture: Unknown | Os: Unknown
--------------------------------------------+-------------------------------
It would be nice if (x,y,z) were syntactic sugar for a
[http://homepages.cwi.nl/~ralf/HList/ 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.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1245>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list