Matt Harden wrote:
> 
> Mark Tullsen wrote:
> > Matt Harden wrote:
> > >    o  A Zippable class be created, defining zip and unzip for all tuple
> > > types (or at least the first few)
> >
> > For _all_ tuple types?  That's a lot of instance declarations ;-)!
> 
> No doubt.  But seriously, I was thinking of a "built-in" Zippable
> instance just like we have for Ord, Enum, Show, etc.  

That's what I thought you meant. But since I have a pet peeve about
how Haskell implementations work ...

> I think the
> language definition specifies these instances for all tuple types that
> have sensible instances of these classes. 

Yes, AFAIK the Report doesn't say anything about implementations being
allowed to not support "deriving" for 6-tuples or 8-tuples or whatever.

> Actual Haskell
> implementations don't provide these instances for all tuples, AFAIK.

Yes, ugh.  I just tested hugs and ghc: they stop at 5-tuples.

Someone can correct me if I'm wrong, but the problem appears to
arise because tuples are not "really" first class in Haskell.
They are just syntactic sugar for fully applied uses of the 
following constructors:
  (,) 
  (,,)
  (,,,)
  ...
Which seems to be the reason why tuples are lifted in Haskell.
(Or they are lifted for other reasons, and thus this implementation
then makes sense.)

> 
> > <shameless plug>
> >
> > I have a paper ("The Zip Calculus", MPC 2000) which is a bit more
> > ambitious, and is correspondingly more complex.  My solution allows
> > one to write the generic zip without use of the class system and
> > the theoretic need for an infinite number of instance declarations.
> > It allows you to write transpose
> >   transpose  :: ((a,b),(c,d),(e,f)) -> ((a,c,e),(b,d,f))
> > generically for any m*n "matrix".
> >
> > I hope to write up a proposal for how to add this capability to Haskell
> > in the not too distant future.
> >
> > You can get the paper here if you're interested:
> >   http://cs-www.cs.yale.edu/~tullsen/zip-mpc.ps
> 
> I have lots of questions, but I'll wait until I've read your paper.

The paper is a little heavy going with all this Pure Type System
stuff.  In case it's helpful, I put a copy of the slides from my
MPC talk on the web:
  http://cs-www.cs.yale.edu/~tullsen/zip-mpc-talk.ps

- Mark

Reply via email to