Random Color
Mike T. Machenry
dskippy@ccs.neu.edu
Thu, 21 Nov 2002 00:34:14 -0500
Andrew and list,
I am a beginer. I really don't know what I would do if I derived
Color from Enum. You say I could create elements that way. Is there
some simple example someone could post to the list? Thank you for
your help.
-mike
On Thu, Nov 21, 2002 at 01:55:55PM +1100, Andrew J Bromage wrote:
> G'day all.
>
> On Wed, Nov 20, 2002 at 08:44:36PM -0500, Mike T. Machenry wrote:
>
> > I am trying to construct an infinate list of pairs of random colors.
> > I am hung up on getting a random color. I have:
> >
> > data Color = Blue | Red | Green deriving (Eq, Ord, Show)
> >
> > am I supposed to instantiate a Random class instance from color?
>
> You could derive instances of Enum (and possibly also Bounded) and
> create random elements that way.
>
> Cheers,
> Andrew Bromage