[Haskell-cafe] Gloss and relatively expensive computations

Daniel Díaz Casanueva dhelta.diaz at gmail.com
Sun Dec 30 20:22:19 CET 2012


Hi Artyom!

Thanks for your response. It seems your tactic has worked. I was so focused
on programming "inside" the gloss parameter that I completely forgot about
programming in the "outside". Here is what I did (I picked MVar's):

myprog s = do
 ...
 var <- newMVar w0
 let loop w = do
       w' <- step s w
       putMVar var w'
       loop w'
 forkIO $ loop w0
 simulateIO ...  (\_ _ w -> fmap (fromMaybe w) $ tryTakeMVar var)

And it's working just fine!

Best regards,
Daniel Díaz.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121230/c67bf3c5/attachment.htm>


More information about the Haskell-Cafe mailing list