{-# LANGUAGE FlexibleContexts #-}-- | Use lazy I\/O for consuming the contents of a source. Warning: All normal-- warnings of lazy I\/O apply. In particular, if you are using this with a-- @ResourceT@ transformer, you must force the list to be evaluated before-- exiting the @ResourceT@.moduleData.Conduit.Lazy(lazyConsume)whereimportData.ConduitimportData.Conduit.Internal(Pipe(..),unConduitM)importSystem.IO.Unsafe(unsafeInterleaveIO)importControl.Monad.Trans.Control(liftBaseOp_)importControl.Monad.Trans.Resource(MonadActive(monadActive))-- | Use lazy I\/O to consume all elements from a @Source@.---- This function relies on 'monadActive' to determine if the underlying monadic-- state has been closed.---- Since 0.3.0lazyConsume::(MonadBaseControlIOm,MonadActivem)=>Sourcema->m[a]lazyConsume=go.unConduitMwherego(Done_)=return[]go(HaveOutputsrc_x)=doxs<-liftBaseOp_unsafeInterleaveIO$gosrcreturn$x:xsgo(PipeMmsrc)=liftBaseOp_unsafeInterleaveIO$doa<-monadActiveifathenmsrc>>=goelsereturn[]go(NeedInput_c)=go(c())go(Leftoverp_)=gop