
25 Apr
2007
25 Apr
'07
1:05 p.m.
There is a fst and a snd function. What about fstOf3 ( \(x,_,_) -> x ) sndOf3 ( \(_,x,_) -> x ) thrdOf3 ( \(_,_,x) -> x ) ? ... or using overloading ? fst snd thrd _4th _5th I think its easier to type/ read than \(_,_,x,_) -> x class Second a b | a -> b where t2 :: a -> b instance Second (a,b) b where t2 (a,b) = b instance Second (a,b,c) b where t2 (a,b,c) = b instance Second (a,b,c,d) b where t2 (a,b,c,d) = b instance Second (a,b,c,d,e) b where t2 (a,b,c,d,e) = b Or is there any drawback I didn't see? I'd like to see them in Data.Tuple Marc