tpetricek / TomaspNet.Website

(*Aug 2013 - †Aug 2016) Source code & hosting for http://tomasp.net
23 stars 15 forks source link

Get rid of misleading symmetry in StateUpdate.Combine #19

Closed kkm000 closed 9 years ago

kkm000 commented 9 years ago

Hi Tomas, I just read your excellent post on the update monad. I stumbled for a few long minutes, though, trying to understand why a \circ b of the StateUpdate is so symmetrical unless both a and b are not noops, before I realized it actually isn't! May I suggest a rewrite in this explicitly asymmetric form? To me, this form seems easier to understand: left to right, SetNop passes v through, but Set b prevails.

Technically, the second case could have been written as | _, v -> v, but that would be didactically wrong, I think :)

tpetricek commented 9 years ago

I spent some time thinking about this and I actually like my version a bit better. Though I can see why it does not work for everyone.

The main reason is that it shows the symmetry in the case when one is SetNop and the other is Set - and then it shows (on the line 2) how the conflicting situation is resolved.

In any case, thanks for reading and for the suggestion!