[Haskell-cafe] Matching constructors

Henning Thielemann lemming at henning-thielemann.de
Fri Feb 10 11:33:26 EST 2006

On Fri, 10 Feb 2006, Creighton Hogg wrote:

> Hi,
> If I have something like
> data Patootie = Pa Int | Tootie Int
> and I want to pull out the indices of all elements of a list
> that have type constructor Tootie, how would I do that?
> I thought I might be able to use findIndices, but I don't
> know how to express the predicate.

(\p -> case p of {Pa _ -> False; Tootie _ -> True})

More information about the Haskell-Cafe mailing list