Fast Reading from File

Saswat Anand iscp9157@nus.edu.sg
Mon, 9 Apr 2001 17:14:34 +0800


I have a need to read large lists of numbers from a file and operate on
them. I tried the following:

read' =do s <- readFile "temp"
              print $ sum $ map (fst.head.readDec)(lines s)

But this is quite slow even for 1000 numbers. 

Are there any other ways to do it faster? Will it help if a C function does
the reading and Haskell calls that. I have to use Hugs.

Thanks,
Saswat