
2 Nov
2007
2 Nov
'07
9:49 a.m.
On 11/2/07, Henning Thielemann
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. Thanks, -- Felipe.