Search code examples
haskelllazy-evaluationbytestring

ByteString.Lazy.Char8 (Not enough space)


This code gives <stdin>: hGetBufSome: resource exhausted (Not enough space) error as soon as it's executed.

import qualified Data.ByteString.Lazy.Char8 as B8
main = do
    (l:_) <- B8.lines `fmap` B8.getContents
    B8.putStrLn l

I'm just trying to get the first line. So because of lazy loading it wouldn't try to get others right? I can't figure out how to avoid this error.


Solution

  • There seems to be a problem with lazy bytestrings on 64-bit Windows 7, e.g.

    Since the reports are all from over a year ago, I would try using GHC 7.8.3 (for example, from the Haskell Platform 2014.2.0.0) if you are not already using that version.