[Haskell-cafe] What is MonadPlus good for?

Keean Schupke k.schupke at imperial.ac.uk
Mon Feb 14 07:40:04 EST 2005


ajb at spamcop.net wrote:

>G'day all.
>
>Quoting David Roundy <droundy at abridgegame.org>:
>
>  
>
>>It might be interesting to write a "backtracking" IO-like monad which
>>obeyed m >> mzero === mzero.  I imagine you could do it for something like
>>an ACID database, if you define === as meaning "has the same final result
>>on the database", which of course would only be useful if the database had
>>sufficient locking that it couldn't have been read between the original m
>>and the later mzero.
>>    
>>
>
>You should talk to the logic programming community about this some time.
>
>As Lee Naish has pointed out on many occasions, it would involve finding a
>way to insert the page back into the laser printer and lift the toner off.
>
>  
>
Not quite... remember the IO monad is a function which returns an
IO program... as long as none of the IO program has been executed it
is possible to 'edit' the program to remove parts...

The problem only really occurs in interactive programs, where input
forces partial evaluation of the function result... once the function
has been evaluated up to the input the output so far cannot be
retracted.

    Keean.



More information about the Haskell-Cafe mailing list