[mercury-users] existential type question
Peter Ross
peter.ross at miscrit.be
Sat Nov 30 22:28:20 AEDT 2002
I don't understand why the program below doesn't work. Can anyone help?
% mmc -e arg2.m
arg2.m:022: In clause for predicate `arg2:p/2':
arg2.m:022: in unification of variable `MaybeArg'
arg2.m:022: and term `arg(Arg)':
arg2.m:022: type error in argument(s) of functor `arg/1'.
arg2.m:022: Argument 1 (Arg) has type `(some [T] T)',
arg2.m:022: expected type was `(some [U] U)'.
For more information, try recompiling with `-E'.
:- module arg2.
:- interface.
:- type t
---> f
; g.
:- type maybe_arg
---> some [U] arg(U)
; no.
:- pred p(t::in, maybe_arg::out) is cc_multi.
:- implementation.
:- import_module std_util.
p(I, MaybeArg) :-
q(I, Univ),
Arg = univ_value(Univ),
MaybeArg = arg(Arg).
:- pred q(t::in, univ::out) is cc_multi.
q(f, univ(1)).
q(f, univ(2)).
q(g, univ(3)).
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list