Apr. 22nd, 2014

juan_gandhi: (VP)
And can't figure out why I did not need it before

  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.
juan_gandhi: (VP)
http://nnils.livejournal.com/ и http://vk.com/id71921051 врет, что живет в Запорожье? Ростов на Дону, наверное.
Впрочем, она мне не кажется психически здоровой.

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

September 2025

S M T W T F S
 1 2345 6
78 9 10 111213
14 151617 181920
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 19th, 2025 08:57 am
Powered by Dreamwidth Studios