[mercury-users] mode error #2
Michael Day
mikeday at bigpond.net.au
Thu Jun 13 11:37:12 AEST 2002
> > mode error: variable `Refs' has instantiatedness
> > `bound((list:[]) ; list:'[|]'((pdf:object), list:list_skel((pdf:object))))',
> >
> > expected instantiatedness was `list:list_skel((pdf:object))'.
> >
> > Is this not the case, given the definition of list_skel?
>
> Yes, I think you're right -- those two insts should be the same.
Here is a test case, note that it appears to be caused by a mistake on my
part, in that app2 is defined to take a list(T) and a T, when it should be
a list(object) and an object. Nonetheless, it's a fairly confusing error
message.
Michael
:- module foo.
:- interface.
:- import_module string, int, list.
:- type object ---> a ; b(func(string) = int).
:- inst object ---> a ; b(func(in) = out is det).
:- func foo(list(object)) = list(object).
:- mode foo(in(list_skel(object))) = out(list_skel(object)) is det.
:- implementation.
foo(Refs) = app2(Refs, a).
:- func app2(list(T), T) = list(T).
:- mode app2(in(list_skel(object)), in(object)) = out(list_skel(object)) is
det.
app2([], Y) = [Y].
app2([X|Xs], Y) = [X|app2(Xs,Y)].
--------------------------------------------------------------------------
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