The input and output variables for a Erlang ‘pragma foreign_proc’ will be the Erlang representations as described in Erlang data passing conventions.
The Erlang code in a
pragma foreign_proc declaration
for a procedure whose determinism indicates that it can fail
must assign either ‘true’ or ‘false’ to the variable
SUCCESS_INDICATOR. For example:
:- pred contains_char(list(char)::in, char::in) is semidet. :- pragma foreign_proc("Erlang", contains_char(Str::in, Ch::in), [will_not_call_mercury, promise_pure, thread_safe], " SUCCESS_INDICATOR = (string:chr(Str, Ch) =/= 0) ").
Arguments whose mode is input will have their values set by the
Mercury implementation on entry to the Erlang code.
The Erlang code must set the values
of all output variables, even if the procedure fails
(i.e. sets the
SUCCESS_INDICATOR variable to