[Haskell-cafe] random colors, stack space overflow, mersenne and mersenne.pure64

Don Stewart dons at galois.com
Fri Sep 12 23:53:18 EDT 2008


cetin.sert:

>    main :: IO ()
>    main = do
>      as <- getArgs
>      mt <- newPureMT
>      let colors = randomRs (lo,hi) mt :: [RGB]
>      print $ zip tx cs
>      where
>        lo = read $ as !! 0
>        hi = read $ as !! 1
>        tx =        as !! 2
>    Why is as not visible in the where block?

Same as:

     main =
       let
         lo = read $ as !! 0
         hi = read $ as !! 1
         tx =        as !! 2
       in do
         as <- getArgs
         mt <- newPureMT
         let colors = randomRs (lo,hi) mt :: [RGB]
         print $ zip tx cs

If that helps think about when things are bound.

-- Don


More information about the Haskell-Cafe mailing list