Extracting values from several data constructors

Steffen Mazanek steffen.mazanek@unibw-muenchen.de
24 Apr 2003 00:45:07 +0200


Hello.
I am sure this question is not new. Even so, please
give me the solution or point me to an old thread.

How can I implement something like:

data Test = T1 Int | T2 Int
test::Test->Int
test (_ x) = x

Or is this impossible? In case of yes, why?
This would save a lot of case differentiations in 
my application. Or is there an appropriate compiler option?

Good night,
Steffen