Re: [Haskell-cafe] Re: working with Random.randoms

2008-06-18 Thread Stephen Howard
Thanks for the replies. This was my solution: module RandomTest ( random_test ) where import Random random_test :: Int - IO String random_test n = do g - newStdGen return $ take n (randomRs printable_ascii g) where printable_ascii = ('!','~') The struggling with the type system was

Re: [Haskell-cafe] Re: working with Random.randoms

2008-06-15 Thread Robert Vollmert
Great reply! One minor point: If real_programme is to be pure, you should use let: On Jun 14, 2008, at 12:30, Jon Fairbairn wrote: main :: IO() do gen - getStdGen the_list - real_programme gen let the_list = real_programme gen print the_list You should be able to deduce

[Haskell-cafe] Re: working with Random.randoms

2008-06-15 Thread Jon Fairbairn
Robert Vollmert [EMAIL PROTECTED] writes: Great reply! Thanks. One minor point: If real_programme is to be pure, you should use let: Whoops! I was thinking let but wrote the wrong thing. If my email had been through a type-checker, it would have spotted the mistake. -- Jón Fairbairn

[Haskell-cafe] Re: working with Random.randoms

2008-06-14 Thread Jon Fairbairn
Stephen Howard [EMAIL PROTECTED] writes: I am a newcomer doing my obligatory struggling with Haskell's type system, That's your mistake. Don't struggle with the type system, the type system is your friend; when it tells you you are doing something wrong, it's usually right. and I've got a