
11 Sep
2012
11 Sep
'12
12:43 p.m.
Is it possible to capture more than one constructor in a single pattern matching? I mean, is it possible to generalize the following pattern matching of A and B to a single branch? g f C = [f C] g f v@(A _ n) = f v : g n g f v@(B _ n) = f v : g n For example: g f C = [f C] g f v@(A|B _ n) = f v : g n Or: g f v = case v of C -> [f C] A|B -> f v : g (n v) Thanks.