[mercury-users] Install problems
Peter Ross
pro at missioncriticalit.com
Sun May 13 09:37:14 AEST 2007
On 5/13/07, Maximillian Murphy <m at de-minimis.co.uk> wrote:
> .------------ERRORS:
> 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.
This error message says you have forgetten the determinism declaration.
> 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'.
See below for this
> For more information, recompile with `-E'.
> ** Error making `Mercury/cs/pretty_print_test.c'.
> `--------------/ERRORS
>
> .--------------SOURCE
> % 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),
you need something like mode type_num(in, out) **is det**
> pred type_num_4(T::in, int::out)
similarly here.
> ].
>
> :- 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.
For this mode, you have to create a value for the first argument, but
you are using _ which means it has no value which of course the
mercury compiler doesn't like.
> foo_type_num_p(_, 42).
>
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to: mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions: mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the users
mailing list