[Haskell-cafe] Matching constructors

Jared Updike jupdike at gmail.com
Fri Feb 10 11:46:06 EST 2006


Or inline as

> findIndices (\x -> case x of Tootie _ -> True; _ -> False) listOfPasAndTooties

There was a recent thread about wanting a more succint way to write
this (unary pattern matching):
http://thread.gmane.org/gmane.comp.lang.haskell.cafe/11109

If John got his wish, then you could write something like
> findIndices (@ Tootie _) listOfPasAndTooties

Maybe this feature will appear in a future Haskell standard? though I
don't see anything on the Haskell' wiki about this...

Cheers
  Jared.
--
http://www.updike.org/~jared/
reverse ")-:"


More information about the Haskell-Cafe mailing list