[Hs-Generics] Sample code
Johan Jeuring
johanj at cs.uu.nl
Tue Oct 24 04:07:51 EDT 2006
>> something of the type t1 -> t2 -> t3 where
>> t3 = f(t1, t2). Generalization of zip/zipWith. I have never
>> seen that example.
>
> how about generic zip?
>
> gzipWith :: (a->b->c) -> C a -> C b -> C c
Good example. In Generic Haskell, gzipWith has type
gzipWith {| t1 :: *, t2 :: *, t3 :: * |} :: (gzipWith {| t1, t2, t3
|}) => (t1,t2) -> Maybe t3
gzipWith is a rather standard generalisation (except for the Maybe)
of gmap, which has type
gmap {| t1 :: *, t2 :: * |} :: (gmap {| t1, t2 |}) => t1 -> t2
so it might not exhibit new properties. But maybe it does lead to
problems in other approaches.
-- Johan
More information about the Generics
mailing list