[m-users.] Adding impurity to Mercury code: Backtracking in IO states

Tomas By tomas at basun.net
Sun Jun 28 21:32:12 AEST 2015


On Sun, June 28, 2015 07:34, Left Right wrote:
> One problem
> is that you are trying to unify two grounded terms, knowing they are
> already grounded and distinct. For instance: IOState_out = IOState_in

IOState_out is not ground.

The line "IOState_out = IOState_in" just means nothing happens on that
side in the disjunction.


> In particular,
> io.write_string needs its third argument to be instantiated as
> "unique" (this is a Mercury's way of saying it has to be obtained from
> doing some other I/O).

I think it is just an historical accident that Mercury only uses unique
modes for I/O.

/Tomas





More information about the users mailing list