
22 Aug
2010
22 Aug
'10
5:46 p.m.
Hi all, I was trying out the enumerator package. I wanted to copy the contents of one file to another: module Main where import Data.Enumerator import Data.Enumerator.IO main = run (enumFile "foo" $$ iterFile "bar") If I compile this code with GHC, it works as expected. But if I run it with runhaskell I get the following error: Left bar: hPutBuf: illegal operation (handle is closed) If I replace the above code with this: module Main where import Data.Enumerator import Data.Enumerator.IO import System.IO main = withBinaryFile "bar" WriteMode $ \h -> run (enumFile "foo" $$ iterHandle h) It works both compiled and interpreted. Is this a bug in enumerator (probably in the iterFile function) or a deficiency of the interpreter?