[mercury-users] Install problems

Maximillian Murphy m at de-minimis.co.uk
Sun May 13 06:33:46 AEST 2007

Hello all,

Alas, building  a second time (as detailed in my previous e-mail) failed.  At least, it seemed to succeed but a test program I copied doesn't compile.  Would one of you ladies and gents be so kind as to try to compile my toy program, just to make sure I haven't fat-fingered a copy and paste?

I've attached he source together with the errors I get.  Here's a preview:

Making Mercury/cs/pretty_print_test.c
pretty_print_test.m:022: Error: no determinism declaration for type class
pretty_print_test.m:022:   method predicate `pretty_print_test.type_num_4'/2.
pretty_print_test.m:020: Error: no determinism declaration for type class
pretty_print_test.m:020:   method predicate `pretty_print_test.type_num_3'/2.
pretty_print_test.m:021: Error: no determinism declaration for type class
pretty_print_test.m:021:   method predicate `pretty_print_test.type_num_3'/2.
pretty_print_test.m:038: In clause for `foo_type_num_p(out, in)':
pretty_print_test.m:038:   mode error: argument 1 did not get sufficiently
pretty_print_test.m:038:   instantiated.
pretty_print_test.m:038:   Final instantiatedness of `HeadVar__1' was `free',
pretty_print_test.m:038:   expected final instantiatedness was `ground'.
For more information, recompile with `-E'.
** Error making `Mercury/cs/pretty_print_test.c'.

% XXX we should also test use of operators

:- module pretty_print_test.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.

:- implementation.

:- type foobar ---> foo ; bar(int) ; baz(int, int).
:- type cont(T) ---> foo ; cont(T, cont(T)).
:- type eq(T1, T2) == foobar.

main --> io__write_int(type_num(42)), io__nl.

:- typeclass numbered_type(T) where [
        func type_num(T) = int,
        func type_num_2(T) = int,
        pred type_num_3(T, int),
        mode type_num_3(in, out),
        mode type_num_3(out, in),
        pred type_num_4(T::in, int::out)

:- instance numbered_type(int) where [
        func(type_num/1) is foo_type_num,
        func(type_num_2/1) is foo_type_num,
        pred(type_num_3/2) is foo_type_num_p,
        pred(type_num_4/2) is foo_type_num_p

:- func foo_type_num(int) = int.
foo_type_num(_) = 42.

:- pred foo_type_num_p(int, int).
:- mode foo_type_num_p(in, out) is det.
:- mode foo_type_num_p(out, in) is det.
foo_type_num_p(_, 42).


Maximillian Murphy <m at de-minimis.co.uk>

More information about the users mailing list