[m-users.] An inst and an exception

Volker Wysk post at volker-wysk.de
Sat Jan 20 02:37:29 AEDT 2024


Hello!

This drives me nuts:


:- pred transform((func(odbc.row) = T), list(odbc.row), list(T)).

:- mode transform(
      in(func(in) = out is semidet), 
      in, out
) is det.

:- mode transform(
      in(func(in) = out is semidet), 
      in(one_element_list), out(one_element_list)
) is det.

:- mode transform(
      in(func(in) = out is semidet), 
      in(non_empty_list), out(non_empty_list)
) is det.

:- inst one_element_list ---> [ground].

transform(_, [], []).

transform(Extr, [Row|Rows], [Data|Rest]) :-     % <- line 1010
    (
        if   Data0 = Extr(Row)
        then
             Data = Data0,
             transform(Extr, Rows, Rest)
        else
             throw(match_error(Row))            % <- line 1017
    ).


I get this from the compiler:

odbc.m:1010: In clause for `transform(in((func(in) = out is semidet)),
odbc.m:1010:   in((odbc.one_element_list)), out((odbc.one_element_list)))':
odbc.m:1010:   mode error: argument 3 had the wrong instantiatedness.
odbc.m:1010:   Final instantiatedness of `HeadVar__3' was
odbc.m:1010:   `unique('[|]'(ground, ground))',
odbc.m:1010:   expected final instantiatedness was
odbc.m:1010:     named inst one_element_list
odbc.m:1010:     which expands to
odbc.m:1010:       bound(
odbc.m:1010:         '[|]'(
odbc.m:1010:           ground,
odbc.m:1010:           named inst exception.[]
odbc.m:1010:           which expands to
odbc.m:1010:             bound(
odbc.m:1010:               []
odbc.m:1010:             )
odbc.m:1010:         )
odbc.m:1010:       ).

Where does that "unique" come from? What does that "named inst exception.[]"
mean? Does that error message relate to line 1017?


Bye,
Volker


More information about the users mailing list