[Haskell-cafe] Pattern matching articles/explanations

Ian Duncan iand675 at gmail.com
Thu Aug 16 17:19:12 EDT 2007


So what I noticed that "A Gentle Introduction to Haskell" mentioned  
that wild-cards are useful in constructors. For example:

head (x:_) = x

So, does that offer any performance benefits over:

head (x:xs) = x

Or is it primarily to indicate to the coder that xs is useless? I get  
the impression it has a very similar meaning to the irrefutable  
pattern in regards to not evaluating it when the function is called.  
Or am I way off?


More information about the Haskell-Cafe mailing list