Question

Is it possible to compose an arbitrary function with an Enumerator or EnumeratorM, so that each individual item of data being pushed into the iteratee is first preprocessed by applying the function?

Was it helpful?

Solution

With Scalaz 6 at least, no - not if the function has a return type that is different from (and not a subtype of) its argument type, because EnumeratorM's type doesn't allow it to change the input type of the iteratee.

However, it is possible to "pre-compose" arbitrary functions with an iteratee, so I think this is the way to go. Could also maybe use an enumeratee, but this abstraction is not provided in Scalaz 6.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top