[Haskell-cafe] Pattern matching with where free variables can be used more than once

Stefan Holdermans stefan at cs.uu.nl
Fri Jul 17 14:38:54 EDT 2009


> Wouldn't it be great if pattern variables could be used more than once
> in a pattern? Like so:
>    foo [x,x,_,x] =  "The values are the same!"
>    foo _      = "They're not the same!"

These are called nonlinear patterns. I think Miranda (a precursor of  
Haskell, sort of) used to have them.



More information about the Haskell-Cafe mailing list