
15 Jan
2007
15 Jan
'07
4:09 a.m.
Hi I sometimes have a function definition similar to this: myFunction x@(Constructor1 _ _ _ _ _ _) = ... myFunction x@(Constructor2 _ _ _ _ _ _ _ _) = ... which in my eyes is not very elegant and easy to type. Is there an easier way to switch on the different constructors of a type (Data.Generics certainly could be used..)? If not, has thought been put in a pattern matching possibility of the form _*. This would allow: myFunction x@(Constructor1 _*) = ... myFunction x@(Constructor2 _*) = ... Also pattern matches of the form: myFunction2 (Constructor1 _* a _*) = ... could be possible as long as the pattern is non-ambiguous (in this case, only one variable with the type of a is present in this constructor). regards Stefan