Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top