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

Julian Fondren ayrnieu at gmail.com
Sun Feb 11 00:38:45 AEDT 2007

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

(nothing else, it seems)

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