Disclaimer: this was asked recently on the haskell-cafe list. My apologies to anyone bothered by the double post.
All of the iteratee-implementing packages that I know of (e.g. iteratee
, iterIO
, and conduit
) define an enumeratee composition function, except for the enumerator
package. This seems to me like a serious limitation, and yet it also seems relatively straightforward to implement:
import Data.Enumerator
import Data.Enumerator.Internal
(=$=) :: Monad m
=> Enumeratee a0 a1 m (Step a2 m b) -> Enumeratee a1 a2 m b
-> Enumeratee a0 a2 m b
(=$=) e01 e12 step = Iteratee $ do
step' <- runIteratee $ e12 step
runIteratee . joinI $ e01 step'
Is there some gotcha here that I'm missing? Or some other reason for enumerator
not to define enumeratee composition?