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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top