[m-users.] Unintelligible compiler message

Volker Wysk post at volker-wysk.de
Mon Mar 11 09:59:26 AEDT 2019


Hi

I try to compile this little program:

:- module test1.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module list, char, string.
main(!IO) :-
    list.map(string.to_char_list, ["abc", "def"], Liste).

And get this error message from the compiler:

test1.m:010: In clause for `main(di, uo)':
test1.m:010:   mode error in conjunction. The next 2 error messages indicate
test1.m:010:   possible causes of this error.
test1.m:010:   In clause for `main(di, uo)':
test1.m:010:   in call to predicate `list.map'/3:
test1.m:010:   mode error: arguments
test1.m:010:   `TypeCtorInfo_15, TypeInfo_16, V_7, V_8, Liste' have the
test1.m:010:   following insts:
test1.m:010:     unique(<type_ctor_info for .string/0>),
test1.m:010:     bound(
test1.m:010:       type_info(
test1.m:010:         bound(
test1.m:010:           <type_ctor_info for list.list/1>
test1.m:010:         ),
test1.m:010:         bound(
test1.m:010:           <type_ctor_info for .character/0>
test1.m:010:         )
test1.m:010:       )
test1.m:010:     ),
test1.m:010:     free,
test1.m:010:     unique,
test1.m:010:     free
test1.m:010:   which does not match any of the modes for predicate
test1.m:010:   `list.map'/3.
test1.m:010:   In clause for `main(di, uo)':
test1.m:010:   in argument 1 of call to predicate `list.map'/3:
test1.m:010:   mode error in unification of `V_7' and higher-order term based
test1.m:010:   on multi-moded predicate `string.to_char_list'/2.
test1.m:010:   The modes of the argument variables match more than one of the
test1.m:010:   called predicate's modes.

I half-understand that message. But what I don't understand is, why does it 
mention five arguments (`TypeCtorInfo_15, TypeInfo_16, V_7, V_8, Liste') to 
the call of list.map? There are only three!

I'd like to understand that error message. Could anyone point me at how to 
find it in the documentation?

Bye,
Volker




More information about the users mailing list