[Haskell-cafe] IO Help

Thomas Davie tom.davie at gmail.com
Thu May 8 10:36:38 EDT 2008


On 8 May 2008, at 16:31, Mark Wallsgrove wrote:

> Was there? I have been google'ing that problem for ages..
>
> Just one more thing. I have to make a menu system where the user  
> chooses what functionality they want. Because you cannot change a  
> value once it is set I have used recursion so that when something  
> changes it then calls the menu back up. I feel this is way to memory  
> consuming. Is there another way?

While this method feels like it should consume lots of memory, it in  
fact doesn't.  Remember that you're dealing with a graph machine, and  
that no stack is maintained of all the calls you've made.  The garbage  
collector will simply follow you through the menu system clearing up  
the memory behind you.

Bob


More information about the Haskell-Cafe mailing list