Hi Bulat,

On Aug 24, 2006, at 7:52 AM, Bulat Ziganshin wrote:

Hello Gregory,

Thursday, August 24, 2006, 2:29:15 PM, you wrote:

step t = do
         c <- readSTRef (count t)
         s <- readSTRef (state t)
         writeSTRef (count t) (c - 1)
         writeSTRef (state t) (nextState s)
         if (c <= 0) then return Nothing else return (Just c)

as Chris said, you are write unevaluated chunks.

add $! to evaluate values before writing:

          writeSTRef (count t) $! (c - 1)
          writeSTRef (state t) $! (nextState s)


That fixed it exactly.  Thank you Bulat and Chris!

Best Wishes,
Greg


--
Best regards,
 Bulat                            mailto:[EMAIL PROTECTED]

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to