fsharp/fsharpx — pull request #158 by DanielFabian (2012-11-25 23:31:51+00:00)
Title: Add a computation expression for choice.

There was a computation expression for choice, the EitherBuilder, but it was a bit meager and there was not instance of the builder.

I mostly copied the MaybeBuilder, with one change (and I think, that one is maybe a suble bug?):
Zero is implemented as Choice1Of2 (), as opposed to None in the MaybeBuilder.

Is it actually inteded for the computation to abort, just because someone calls Zero? Isn't zero just a valid, empty, value? And if it should break the computation, what would be a reasonable zero for Choice then?

Please review if the semantics make sense. I tried playing with it in FSI and it looks reasonable.