[Haskell-cafe] Newbie question about tuples
Brandon S. Allbery KF8NH
allbery at ece.cmu.edu
Thu Jul 12 04:53:26 EDT 2007
On Jul 12, 2007, at 3:51 , peterv wrote:
> Q1) Is it possible to treat a tuple of N elements in a generic way? So
> instead of writing functions like lift1 e1, lift2 (e1,e2), lift3
> (e1,e2,e3)
> just one function liftN that works on tuples of any length?
>
> Q2) (Maybe related to Q1) Can I convert a tuple of length N to a
> heterogeneous list (using "forall" aka existentially quantified
> types) and
> vice versa?
I'm pretty sure the answer to both of those is "no" because each
length / type combination of tuple is an independent type. (But
watch, someone will come along with a TH or SYB solution, or Oleg
will come up with some gruesome type hackery. :)
--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH
More information about the Haskell-Cafe
mailing list