[m-users.] Determinism error caused by instantiation error, not sure why.

"Sean Charles (emacstheviking)" <[email protected]>
Newsgroups gmane.comp.lang.mercury.general
Message-ID <[email protected]>
The error:

repl.m:738: In `take_gencall'(in, out, in, out, in, out):
repl.m:738:   error: determinism declaration not satisfied.
repl.m:738:   Declared `det', inferred `semidet'.
repl.m:747: In clause for `take_gencall(in, out, in, out, in, out)':
repl.m:747:   warning: unification of `Out' and maybe.yes cannot succeed.
repl.m:747:   `Out' has instantiatedness `unique(no)'.

The code:

:- pred take_gencall(error_msg::in, maybe(snode)::out, s::in, s::out,
    lsnode::in, lsnode::out) is det.

take_gencall(Er, Out, !S) -->
    ( if no_errors(!.S) then
        ( if [GC] then
            { Pos = snpos(GC) },
            ( if { GC = gencall(_, _, _) } then
                 { Out = yes(GC) }   <== line 747
            else
                cerror(Pos, Er, !S),
                { Out = no }
            )
        else
            premature(!S)),
            { Out = no }
    else
        { Out = no }
    ).

For the life of me I don't understand why the line in bold is causing an error, why has Out become `unique(no)` and does that no refer to a general no or is it the no from the may() discriminated union, I just don't see my mistake. Sorry.

Thanks,
Sean.

_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.