On Tue, 29 May 2007 19:28:02 -0400 Isaac Dupree <[EMAIL PROTECTED]> wrote: > Luckily, Haskell's laziness means that doing an extra "postprocessing > pass" doesn't necessarily yield two traversals requiring the whole > file to be stored in memory, nor worse hacks. (For grammars that > aren't too wild / sequential)
But the suggested code fragment on the frisby homepage: -- parse complete file, returning 'Nothing' if parse fails fmap Just (myParser <<- eof) // unit Nothing does require one traversal of the file all by itself. Obviously, in order to know whether the file was fully parsed without error, you need to read in the whole file, before you can write out anything. Hence you end up with *some* representation of the whole file in memory. So, yes, it doesn't necessarily yield two traversals, but you need to be careful if you want to avoid two traversals. -- Robin _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe