[Haskell-cafe] Matching constructors

J. Garrett Morris trevion at gmail.com
Fri Feb 10 11:33:13 EST 2006

tootieIndices = findIndices isTootie
    where isTootie (Pa _)     = False
          isTootie (Tootie _) = True

would be my first approach.


On 2/10/06, Creighton Hogg <wchogg at primula.hep.wisc.edu> 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.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

We have lingered in the chambers of the sea	
By sea-girls wreathed with seaweed red and brown
Till human voices wake us, and we drown.

More information about the Haskell-Cafe mailing list