[Haskell-cafe] Lazy vs correct IO
Ketil Malde
ketil at malde.org
Fri Sep 19 07:43:37 EDT 2008
oleg at okmij.org writes:
> It is interesting to compare the above main function with the
> corresponding lazy IO:
Minor point I know, but aren't you really comparing it with the
corresponding *strict* IO?
> main'' = do
> names <- getArgs
> files <- mapM readFile names
^^^^
> print $ length $ words (concat files)
This works nicely if you replace the middle line with a lazy version, e.g.:
files <- mapM (unsafeInterleaveIO . B.readFile) names
-k
--
If I haven't seen further, it is by standing in the footprints of giants
More information about the Haskell-Cafe
mailing list