On Sun, 19 Dec 2010, ender wrote:

Hi Henning:
  Thanks for your quick reply. So recursive and monad is the proper
way to simulate loop,right?

I kept close to your suggestion, but avoiding monads, especially IO, is a good idea. If you do not need low-level memory access with peek and poke, better use lists or arrays (high level) or StorableVector (more efficient but not as flexible as array).

http://www.haskell.org/haskellwiki/Avoiding_IO

Avoiding explicit recursion is also a good thing - using too much (tail) recursive function calls ends up looking like code with lots of GOTOs. Better use higher order functions.

http://www.haskell.org/haskellwiki/Haskell_programming_tips#Avoid_explicit_recursion

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to