[mercury-users] Documentation error: "Result is either 'ok' or 'error'." isn't.

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Feb 12 14:35:59 AEDT 2007


On Sat, 10 Feb 2007, Julian Fondren wrote:

> The 'io' module docs say:
>
>    % io.see(File, Result, !IO).
>    %
>    % Attempts to open a file for input, and if successful,
>    % sets the current input stream to the newly opened stream.
>    % Result is either 'ok' or 'error'.
>    %
> :- pred io.see(string::in, io.res::out, io::di, io::uo) is det.
>
> and, taking this on its word without looking at the definition of
> io.res, I got this error from this compiler:
>
> forget.m:017: In clause for predicate `forget.glimpse/4':
> forget.m:017:   type error in unification of variable `Result'
> forget.m:017:   and constant `error'.
> forget.m:017:   variable `Result' has type `(io.res)',
> forget.m:017:   constant `error' has type `(pred string)'.
>
> when it interpreted a ( Result = error, ... ; Result = ok ) switch
> as binding Result to require.error/1 !  Of course, my code is wrong,
>
> :- type io.res ---> ok ; error(io.error).
>
> but still, *other* comments say error(ErrorCode) or such :-)
>
> Comments that get this wrong:
>
> io.see/4, as above
> io.see_binary/4
>
> (nothing else, it seems)

Thanks for pointing this out; I've fixed the comments in question.

Julien.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list