[m-users.] is there a easy way to wrap Erlang's improper_list/2 and something similar?
Julien Fischer
jfischer at opturion.com
Tue Dec 31 15:14:35 AEDT 2013
Hi,
On Tue, 31 Dec 2013, Xiaofeng Yang wrote:
> Thanks. But, if I do like this way, I should always convert between
> Erlang code and Mercury code. Is there a way to have an equivalent
> type in Mercury ?
Yes, you could use the Mercury's foreign language interface to do that.
Somthing like:
:- type improper_list(C, T).
:- pragma foreign_type("Erlang", improper_list(C, T), "").
Since improper_list/2 will be an abstract type as far as any Mercury
code is concerned you would also need to write some predicates to
manipulate values of that type using foreign_proc pragmas for Erlang.
(See the ``Foreign language interface'' section of the reference manual
for more details.)
Cheers,
Julien.
More information about the users
mailing list