[Haskell-cafe] How to variables
bulatz at HotPOP.com
Tue Jul 19 01:48:53 EDT 2005
Monday, July 18, 2005, 10:14:43 PM, you wrote:
rd> main = loop 0 0 0 -- initial values
rd> where loop loop_num xpos ypos =
rd> do e <- pollEvent
rd> let xpos' = <calculate new xpos>
rd> ypos' = <calculate new ypos>
rd> someActionInvolvingPosition xpos' ypos'
rd> when breakCondition (return ())
rd> loop (loop_num+1) xpos' ypos'
the last two lines should be
then return ()
else loop (loop_num+1) xpos' ypos'
`when` can only conditionally execute some code, it can't be used to
return from center of `do` body!
Bulat mailto:bulatz at HotPOP.com
More information about the Haskell-Cafe