Discussion: Add safeWithFile function
Henning Thielemann
lemming at henning-thielemann.de
Mon Oct 13 12:55:19 UTC 2014
On Mon, 13 Oct 2014, David Feuer wrote:
> I was thinking
>
> safeHGetContents :: (NFData a) => Handle -> (String -> a) -> IO a
>
> and/or
>
> safeHGetContents :: (NFData a) => Handle -> (String -> IO a) -> IO a
>
> and/or something more explicitly targeting multiple handles (which I think there must be a nice way to do,
> somehow!).
I see. Then a better name might be
DeepSeq.IO.withContents
or
DeepSeq.IO.withFileContents
or
DeepSeq.IO.hWithContents
I still think, that 'safe' is not a good part of a Haskell function name,
because 'safe' should be the default. If at all, we could rename
hGetContents to unsafeHGetContents.
A nested call to withContents would still run deepseq twice, right?
More information about the Libraries
mailing list