just figured I need this
Apr. 22nd, 2014 02:48 pmAnd can't figure out why I did not need it before
What happens here. I have a type for a result which value I don't care about; any result can be an Outcome.
Now I have a sequence of outcomes; I need just one, OK if everything's ok, or a list of errors.
So there. I just fold results, using tensor product, aka merge, merging the whole sequence into just one value.
type Outcome = Result[Any] object OK extends Good('OK) with Outcome def fold(results:Traversable[Outcome]):Outcome = ((OK:Outcome) /: results)(_<*>_) map (_ => 'OK)
What happens here. I have a type for a result which value I don't care about; any result can be an Outcome.
Now I have a sequence of outcomes; I need just one, OK if everything's ok, or a list of errors.
So there. I just fold results, using tensor product, aka merge, merging the whole sequence into just one value.