[Haskell-cafe] using an external application

Felipe Lessa felipe.lessa at gmail.com
Fri Nov 2 05:03:25 EDT 2007

On 11/2/07, Stuart Cook <scook0 at gmail.com> wrote:
> The solution would be to use a version of "readFile" that works in a
> stricter way, by reading the file when it's told to, but I don't have
> an implementation handy.

I guess this does the job:

> readFile' fp = do
>   contents <- readFile fp
>   let ret (x:xs) = x `seq` ret xs
>       ret []     = return contents
>   ret contents

Maybe the "x `seq`" part isn't necessary at all.


More information about the Haskell-Cafe mailing list