[Haskell-cafe] Conduit Error Output: Control.Monad.Trans.Resource.stateCleanup

Lyndon Maydwell maydwell at gmail.com
Tue Feb 21 04:46:03 CET 2012


Hi Michael, Café.

I'm writing some code using the conduit library and am encountering
the following error output (while the program appears to function
correctly) when using Data.Conduit.Lazy.

The error given is:

> profile_simple_test_data: Control.Monad.Trans.Resource.stateCleanup: There is a bug in the implementation. The mutable state is being accessed after cleanup. Please contact the maintainers.

A reduced code snippet that generates this error is (also attached):

> import Control.Monad
> import System.Environment
> import Control.Monad.IO.Class (liftIO)
> import System.IO
> import Data.Conduit.Lazy
> import Data.List (sort)
>
> import Data.Conduit
>
> import Prelude hiding (map)
>
> main = getArgs >>= process
>
> process args = mapM_ sorted args
>
> sorted x = runResourceT (lazyConsume $ sourceFeed x) >>= (mapM_ print . id)
>
> sourceFeed :: ResourceIO m => FilePath -> Source m String
> sourceFeed file = sourceIO
>     (openFile file ReadMode)
>     hClose
>     (\h -> liftIO $ do
>         eof <- hIsEOF h
>         if eof
>             then return IOClosed
>             else fmap IOOpen $ hGetLine h)

when run over any text file.

I may be doing something inconsistent with the correct use of sourceIO
or lazyConsume, however, I tried to follow the example at
http://www.yesodweb.com/home/snoyberg/blogs/conduit/conduit/source/source.ditamap?nav=nav-2
as closely as possible.

Is this a bug, or simply an incorrect use of Conduit?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: conduit_error.hs
Type: application/octet-stream
Size: 604 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120221/00cc9f83/attachment.obj>


More information about the Haskell-Cafe mailing list