Hi Peter,

2007/7/12, peterv <[EMAIL PROTECTED]>:
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?

Not in the standard libraries.

I've been using a home-grown module for this sort of thing:

http://antti-juhani.kaijanaho.fi/darcs/fenserve/fendata/TupleUtils.hs

Q3) Suppose I want to declare an instance of Num on all tuple types having
(Num instances) as elements; is this possible?

I tried

       instance Num a => Num (a,a) where .

but this fails

This is illegal in Haskell 98, but should work in GHC if you use -fglasgow-exts.

- Benja
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to