
29 Aug
2007
29 Aug
'07
12:55 p.m.
On Tue, Aug 28, 2007 at 02:14:15PM -0400, David Roundy wrote:
Another option would be to avoid exceptions and instead make the job return explicitly whether or not to continue
eventLoop :: (EventType -> IO ContinueOrNot) -> IO () [...] data ContinueOrNot = ExitNow | KeepGoing
[...]
But I'm not sure either of these is optimal. Exceptions are ugly. You could also (given you're in a state monad) throw a "stop now" flag into that state, which is perhaps better than either of these. Then you'd only need to specify exitLoop (or whatever you choose to call it)...
I think exceptions are not the right solution. Instead I like the other two and I'll study them. Thanks Andrea