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.

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to