
On Thu, Apr 28, 2011 at 12:09 PM, Felipe Almeida Lessa
I foresee one problem: what is the leftover of 'manyToOne xs' if each x in xs needs different lengths of input?
One possible untested-but-compiling solution: [snip]
Like I said, that manyToOne implementation isn't very predictable about leftovers. But I guess that if all your iteratees consume the same input OR if you don't care about leftovers, then it should be okay. *Main> E.run $ E.enumList 1 [5 :: Int, 6, 7] E.$$ manyToOne [return 1, maybe 2 id `fmap` E.head, return 3, maybe 4 id `fmap` (E.head >> E.head)] >>= \xs -> (,) xs `fmap` E.head Right ([1,5,3,6],Just 7) *Main> E.run $ E.enumList 10 [5 :: Int, 6, 7] E.$$ manyToOne [return 1, maybe 2 id `fmap` E.head, return 3, maybe 4 id `fmap` (E.head >> E.head)] >>= \xs -> (,) xs `fmap` E.head Right ([1,5,3,6],Just 6) Cheers, -- Felipe.