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

August 2025

S M T W T F S
      12
3456789
10 11 12 13141516
17181920212223
24252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 19th, 2025 10:37 pm
Powered by Dreamwidth Studios