Any mutually recursive set of functions calling in tail position should be fine - all your examples are ok.
Hello everyone_______________________________________________In C you can't implement main loop with recursion likevoid mainLoop() {doSomething();mainLoop();}because without optimisations stack will overflow.In haskell it's common to writemainLoop = doSomething >> mainLoop, and it doesn't leak memory because of haskell's evaluation model.Does memory leak or argument stack overflow happen in this case?mainLoop = doSomething >> mainLoop >> exit ExitSuccessWhat about this case?mainLoopModeA = dodoSomethingwhen condition mainLoopModeBmainLoopModeAmainLoopModeB = dodoSomethingElsewhen anotherCondition mainLoopModeAmainLoopModeB
or this case?mainLoopModeA = dodoSomethingif conditionthen mainLoopModeBelse mainLoopModeAmainLoopModeB = dodoSomethingElseif anotherConditionthen mainLoopModeAelse mainLoopModeB
--Nikita Fufaev
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.