[Hs-Generics] Sample code

Johan Jeuring johanj at cs.uu.nl
Sat Oct 28 05:01:59 EDT 2006


>>> 	something of the type t1 -> t2 -> t3 where
>>> 	t3 = f(t1, t2). Generalization of zip/zipWith. I have never
>>> seen that example.
>>>
>>>
>>> 	Obviously a lot is missing in the above -- in particular, good
>>> names for the examples, and the test data. And the idea how to
>>> organize the files with examples and test data within our DARCS
>>> repository.
>
>> I think these are good examples. The only thing I miss is a generic
>> variant
>> of map :: (a->b) -> [a]->[b].
>
> Though the generic zipWith function would already demonstrate the  
> power
> of the library --- if you can do generic zipWith, you should be  
> able to do
> generic map.

Yes, gzipWith can be viewed as a generalisation of map. But it is a  
bit more
complex (with three type variables, and an occurrence of Maybe). Does  
gzipWith
add something if you have gmap? Otherwise I prefer to take gmap.

-- Johan



More information about the Generics mailing list