[Haskell-cafe] Pattern matching

Stefan O'Rear stefanor at cox.net
Mon Jan 15 04:16:02 EST 2007


On Mon, Jan 15, 2007 at 10:09:10AM +0100, Stefan Aeschbacher wrote:
> Hi
> 
> I sometimes have a function definition similar to this:
> 
> myFunction x@(Constructor1 _ _ _ _ _ _) = ...
> myFunction x@(Constructor2 _ _ _ _ _ _ _ _) = ...

myFunction x at Constructor1{} = ...
myFunction x at Constructor2{} = ...

this works even for non-record types


More information about the Haskell-Cafe mailing list