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

Cetin Sert cetin.sert at gmail.com
Fri Sep 12 22:23:58 EDT 2008


Oh thank you both *^o^*... now works like a charm again.

Btw, Cetin, this is good practice, along with -funbox-strict-fields:

   data RGB = RGB !Int !Int !Int
       deriving Show

Much better code than using a lazy triple.

Where can I read more of such good practice? Looking forward to Real World
Haskell to read lots of code, hope it'll help lots of people interested in
learning haskell. (Will be released around Christmas here in Germany, I
think.)

CS

2008/9/13 Don Stewart <dons at galois.com>

> bertram.felgenhauer:
> > Cetin Sert wrote:
> > [snip]
> > > colorR :: RandomGen g ⇒ (RGB,RGB) → g → (RGB,g)
> > > colorR ((a,b,c),(x,y,z)) s0 = ((r,g,b),s3)
> > >   where
> > >     (r,s1) = q (a,x) s0
> > >     (g,s2) = q (b,y) s1
> > >     (b,s3) = q (c,z) s2
> > >     q = randomR
> >
> > Look closely at how you use the variable 'b'.
>
> :-) fast eyes.
>
> Btw, Cetin, this is good practice, along with -funbox-strict-fields:
>
>    data RGB = RGB !Int !Int !Int
>        deriving Show
>
> Much better code than using a lazy triple.
> _______________________________________________
> 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/20080913/5aeb9bfb/attachment.htm


More information about the Haskell-Cafe mailing list