[mercury-users] nested "narrowing" modes

Chris King colanderman at gmail.com
Wed Apr 6 09:38:50 AEST 2011


Hi, when I have a predicate which "narrows" the instantiatedness of
its argument, e.g.:

:- type t ---> a; b.
:- pred foo(t).
:- mode foo(bound(a; b) >> bound(a)) is semidet.
foo(a).

it compiles and works as expected.  But if I try to narrow a nested type, e.g.:

:- type u ---> c(t).
:- pred bar(u).
:- mode bar(bound(c(bound(a; b))) >> bound(c(bound(a)))) is semidet.
bar(c(a)).

I get an error stating that the final instantiatedness is the same as
the original instantiatedness.  Curiously binding an argument to a
nested instantiatedness works as expected:

:- mode bar(free >> bound(c(bound(a)))) is det.

I've tried looking in the bug database and found nothing related to
this.  Is it a theoretical limitation?

(Note: I've used bound(a; b) instead of ground to work around bug 191,
however even with my patch for bug 191 applied I get the same issues
regardless of which instantiatedness I use.)

Thanks,
Chris
--------------------------------------------------------------------------
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