[Haskell-cafe] Re: Library design question

Daniel Fischer daniel.is.fischer at web.de
Sat Sep 20 12:17:09 EDT 2008


Am Samstag, 20. September 2008 17:46 schrieb Andre Nathan:
> On Sat, 2008-09-20 at 14:56 +0200, Daniel Fischer wrote:
> > > modify' f = do
> > >     s <- get
> > >     put $! f s
> >
> > Or try Control.Monad.State.Strict.
>
> Control.Monad.State.Strict did it for me, but the strict modify didn't.
> I tried using modify' and also
>
>   randomDouble = do
>     g <- get
>     let (r, g') = random g
>     put $! g'
>     return r
>
> instead of
>
>   randomDouble = State random
>
> Any hints on how I could find where else the program is being too lazy?
>

Profiling. Find out where your programme spends its time and what uses the 
memory. Add lots of {-# SCC #-} pragmas to get a more detailed picture.

> Thanks,
> Andre



More information about the Haskell-Cafe mailing list