[Haskell-cafe] Picking out elements of a heterogenous list

Creighton Hogg wchogg at gmail.com
Tue Dec 5 12:08:07 EST 2006


Hi Haskell-ers,
So I think I understand the idea of creating a heterogenous list using
typeclasses and existentials, but I don't see how to filter the list
to retrieve elements of the list that are of only one type.

More concretely, taking the example
here<http://haskell.org/haskellwiki/Existential_type>how could we take
a list of shapes [Shape] and pull out all objects that are
Squares?
I don't see an obvious way this makes sense.
Is there a way of doing heterogenous lists that would make this possible?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20061205/823f57fe/attachment.htm


More information about the Haskell-Cafe mailing list