[Haskell-cafe] Simple program. Simple problem?
michael rice
nowgate at yahoo.com
Sun Oct 11 19:47:18 EDT 2009
For the code below, if I CNTL-C after the list is printed, and run it again, I get a different list of colors, each time. This doesn't seem to be happening with my earlier example.
Michael
=============
import System.Random
import Data.Ord
data Color
= Red
| Blue
| Green
| Yellow
| Orange
| Brown
deriving (Show, Read, Eq, Enum, Ord, Bounded)
main = do
gen <- getStdGen
let code = map toEnum $ take 4 $ randomRs (0,5) gen :: [Color]
putStrLn $ "List is " ++ show code
guessString <- getLine
newGen <- newStdGen
main
--- On Sun, 10/11/09, Felipe Lessa <felipe.lessa at gmail.com> wrote:
From: Felipe Lessa <felipe.lessa at gmail.com>
Subject: Re: [Haskell-cafe] Simple program. Simple problem?
To: haskell-cafe at haskell.org
Date: Sunday, October 11, 2009, 7:08 PM
On Mon, Oct 12, 2009 at 12:42:16AM +0200, Peter Verswyvelen wrote:
> btw I always find it amusing to play with interact and lazy IO:
I always find it frightening to play with lazy IO :).
--
Felipe.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe at haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091011/f8b17a40/attachment.html
More information about the Haskell-Cafe
mailing list