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
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 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?