[Haskell-cafe] Practical Haskell question.

Henning Thielemann lemming at henning-thielemann.de
Mon Jun 25 05:29:52 EDT 2007

On Mon, 25 Jun 2007, Michael T. Richter wrote:

> OK, just to prevent this getting side-tracked: I'm absolutely
> uninterested in the results of performActionA before determining if
> performActionB is permitted/possible/whatever.  Think more in terms of
> security permissions or resource availability/claiming than in terms of
> chaining results.

We have understood this.

> I want to know before I begin to collect the results of performAction*
> that I will actually stand a chance at getting results at all.

It's irrelevant, what you want. :-) In principle you can write
'performActionB x' and the monad concept urges you to handle this even if
you know, that the check that is integrated in performActionB will not
depend on x.

Wouter gave you another example which shows the problem. If there is a
monad which handles your problem, then you can write

do b <- performActionA
   if b
     then performActionB
     else performActionC

You see that only one of the checks B or C can be performed, and this
depends on the result of performActionA.

Btw. I'm interested how you solve this problem in C++ in an elegant way.

More information about the Haskell-Cafe mailing list