« Return to Thread: Cont, ContT and IO()

Re: Cont, ContT and IO()

by Bulat Ziganshin-2 :: Rate this Message:

Reply to Author | View in Thread

Hello Günther,

Saturday, July 4, 2009, 3:11:23 AM, you wrote:

> I've got an IO action, some file system IO, traversing one level only and
> iterating over files found. I wish to build in an "early" exit, ie. if an
> IO action in the loop encounters a particular value I want it to abort the
> loop.

just make an explicit loop:

process [] = return ()
process (file:files) = do x <- doit file
                          if x>0 then process files
                                 else return ()
--
Best regards,
 Bulat                            mailto:Bulat.Ziganshin@...

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

 « Return to Thread: Cont, ContT and IO()