[m-dev.] mmc bug
Peter Schachte
schachte at csse.unimelb.edu.au
Tue Mar 7 12:33:58 AEDT 2006
Hi,
It seems that Mark's concern about mmc handling any>>ground modes was
justified. The attached test program gives this error:
ground.m:049: In predicate `ground.eq/4':
ground.m:049: warning: declared impure but actually pure.
ground.m:057: In clause for `label((any >> ground))':
ground.m:057: mode error: argument 1 did not get sufficiently
instantiated.
ground.m:057: Final instantiatedness of `HeadVar__1' was
`bound((list.[]) ;
ground.m:057: list.'[|]'(any, any))',
ground.m:057: expected final instantiatedness was `ground'.
ground.m:023: In `label1((any >> ground))':
ground.m:023: warning: determinism declaration could be tighter.
ground.m:023: Declared `nondet', inferred `det'.
Ignore the warnings at the beginning and end. The error in the middle
suggests to me that mmc doesn't think an any can ever become ground.
--
Peter Schachte You should always go to other people's funerals;
schachte at cs.mu.OZ.AU otherwise, they won't come to yours.
www.cs.mu.oz.au/~schachte/ -- Yogi Berra
Phone: +61 3 8344 1338
-------------- next part --------------
%----------------------------------------------------------------------------%
% Copyright (C) 2006 Peter Schachte
% This file may only be copied under the terms of the GNU General
% Public License - see the file COPYING included in the distribution
%----------------------------------------------------------------------------%
%
% RCS : $Id$
% Authors : schachte (Peter Schachte)
% Purpose : test case
%
:- module ground.
:- interface.
:- import_module list.
:- import_module int.
:- solver type fdvar.
:- pred new_fdvar(fdvar::oa) is det.
:- pred eq(fdvar::ia, fdvar::ia) is semidet.
:- pred label(list(fdvar)::(any>>ground)) is nondet.
:- pred label1(fdvar::(any>>ground)) is nondet.
:- func value(fdvar) = int is det.
:- implementation.
:- import_module propagation.
:- import_module any_util.
:- solver type fdvar
where representation is int,
initialisation is new_fdvar,
equality is eq.
new_fdvar(V) :-
promise_pure
( impure V = 'representation to any fdvar/0'(0)
).
eq(X, Y) :-
promise_pure
( impure invoke(eq(X, Y))
).
:- impure pred eq(fdvar::ia, fdvar::ia, pqueue::di, pqueue::uo) is semidet.
eq(X, X, !PQ).
label([]).
label([X | Xs]):-
label1(X),
label(Xs).
label1(X) :-
promise_pure
( unsafe_cast_to_ground(X)
).
value(_) = 42.
More information about the developers
mailing list