[Haskell-cafe] using an external application

Felipe Lessa felipe.lessa at gmail.com
Fri Nov 2 05:49:13 EDT 2007

On 11/2/07, Henning Thielemann <lemming at henning-thielemann.de> wrote:
> The "unlazying" procedure looks much like the "lazying" one, and I wonder
> whether it would be a good idea to eventually add "readFileStrict",
> "getContentStrict" and "hGetContentStrict" to the standard library.

As we're talking about getContents and readFile, how about

> intercept :: Monad m => m a -> (a -> m b) -> m a
> intercept x g = do {r <- x; g r; return r}
> readFileC :: FilePath -> IO String
> readFileC fp = intercept (readFile fp) (forkIO . process)
>   where process xs = last xs `seq` return ()

Is readFileC useful in practice? I mean, does reading further
concurrently makes sense in any useful context?

Also, does intercept already exists in a library? Hoogle didn't help me a lot.



More information about the Haskell-Cafe mailing list