4 ms·
It's just getContents (and brother hGetContents). Using getContents is fine for a quick way to slurp in a file, but it's like doing a read without checking for
by jfoutz 17y ago
It's just getContents (and brother hGetContents).
Using getContents is fine for a quick way to slurp in a file, but it's like doing a read without checking for -1. Since haskell is lazy, figuring out why an underlying read failed can be fairly confusing.
If you think your program is doing IO and there's no IO type getting in the way, unsafePerformIO is lurking in the darkness.
- camccann 17y agoWell, I was confused because getContents seems to be of type "IO String": http://www.haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v%3AgetContents http://www.haskell.org/ghc/docs/latest/html/libraries/base/P... I can see why a lazy input stream could make things opaque even in a completely type-safe program, though.