[Haskell-beginners] Heterogeneous Lists

Michael Snoyman michael at snoyman.com
Wed Nov 17 14:39:46 EST 2010


On Wed, Nov 17, 2010 at 9:35 PM, John Smith <voldermort at hotmail.com> wrote:
> My program needs a list such as [IO 3, IO "f", IO 'z'] :: Show s => [IO s].
> Is there any way to achieve this without wrapping all the values in
> existentially quantified types?

Short answer: no. Slightly longer answer: you could just apply "show"
to each element in the list and get a list of Strings.

Michael


More information about the Beginners mailing list