Re: [m-users.] Confused my det/multi error message, full disjunction of type in place.
Julien Fischer <[email protected]>
| Newsgroups | gmane.comp.lang.mercury.general |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 4 Dec 2022, Sean Charles (emacstheviking) wrote:
> And the code, I just don't understand, as usual, what the compiler is
> trying to tell me. The io.nl/2 is det, so that can't fail, and
> presumably the field update can't fail either. And why hasn't this
> error been raised on all the other cases?
>
>
> Â Â Â 59 :- pred write_(fstate::in, fstate::out, fi::in, io::di, io::uo) is det.
> Â Â Â 60
> Â Â Â 61 write_(!S, nl, !IO) :-
> Â Â Â 62 Â Â io.nl(!IO),
> Â Â Â 63 Â Â !:S = !.S ^nl_written := yes.
> Â Â Â 64
> Â Â Â 65 write_(!S, brace_o, !IO) :-
> Â Â Â 66 Â Â write_(!S, s("{"), !IO),
> Â Â Â 67 Â Â !:S = !.S ^tab_size := !.S ^tab_size+1.
^^^
> Â Â Â 68 Â Â write_(!S, nl, !IO).
Presuambly, the period marked above is actually supposed to be a comma.
(Because it's a period, you have two clauses that match nl.)
Julien.
_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users