I didn't know that, but there's a lot I don't know about Haskell.

It works great.

Thanks!

Michael

--- On Tue, 4/14/09, John Dorsey <hask...@colquitt.org> wrote:

From: John Dorsey <hask...@colquitt.org>
Subject: Re: [Haskell-cafe] Printing list of enum type
To: "michael rice" <nowg...@yahoo.com>
Cc: haskell-cafe@haskell.org
Date: Tuesday, April 14, 2009, 3:33 PM

Michael,

> What do I need to add to this Color enum type to print a list of them?

You can also easily print a list of /all/ of them.

Regards,
John

scratch$ cat color.hs 

data Color
    = Red
    | Blue
    | Green
    | Yellow
    | Orange
    | Brown
    | White
    | Black
  deriving (Show,Enum,Bounded)

scratch$ ghci color.hs 
*Main> [minBound..maxBound] :: [Color]
[Red,Blue,Green,Yellow,Orange,Brown,White,Black]




      
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to