1 implementation module GenMap
3 import StdClass, StdArray, StdInt, StdFunc
4 import StdGeneric, _Array
6 generic gMap a b :: .a -> .b
8 gMap{|PAIR|} fx fy (PAIR x y) = PAIR (fx x) (fy y)
9 gMap{|EITHER|} fl fr (LEFT x) = LEFT (fl x)
10 gMap{|EITHER|} fl fr (RIGHT x) = RIGHT (fr x)
11 gMap{|CONS|} f (CONS x) = CONS (f x)
12 gMap{|FIELD|} f (FIELD x) = FIELD (f x)
13 gMap{|OBJECT|} f (OBJECT x) = OBJECT (f x)
14 gMap{|{}|} f xs = mapArray f xs
15 gMap{|{!}|} f xs = mapArray f xs
17 derive gMap [], (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,)