[Haskell-cafe] Re: Practical Haskell question.
apfelmus
apfelmus at quantentunnel.de
Mon Jun 25 06:44:56 EDT 2007
Michael T. Richter wrote:
> It looked to me like there were people arguing about whether the "x"
> returned from one action was going to be used in the next action.
>
> Let me try and rephrase the question. :)
>
> [rephrase]
Yes, and that's an important constellation your problem description does
not consider. Take the code
doStuff():
if checkPossible( ?? ):
x <- A
if x
then B
else C
else:
exception "Preconditions not met"
What should be put as argument into checkPossible? checkPossible([opA,
opB, opC])? What if x happens to be always true and C is never run? What
if B is possible if and only if C is not?
Sequencing actions is not just putting them in a row, but also feeding
the results of one action to the next ones. You have to restrict this in
some way to make your goal possible.
> And can it be done somehow in Haskell?
Most likely, and Haskell even tells you when your approach doesn't work
without further specification :)
Regards,
apfelmus
More information about the Haskell-Cafe
mailing list