[mercury-users] strange mmc behavior
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Jul 26 18:55:30 AEST 2001
On 26-Jul-2001, Holger Krug <hkrug at rationalizer.com> wrote:
> On Thu, Jul 26, 2001 at 07:32:33AM +1000, Fergus Henderson wrote:
> > On 25-Jul-2001, Holger Krug <hkrug at rationalizer.com> wrote:
> > > :- module lex.
> > >
> > > :- implementation.
> > >
> > > :- pred live_lexeme_in_accepting_state(list(live_lexeme(Tok)),
> > > annotated_token(Tok)).
> > > :- mode live_lexeme_in_accepting_state(in(live_lexeme_list),
> > > out(annotated_token)) is semidet.
> > >
> > > live_lexeme_in_accepting_state([L | Ls], Token) :- % line 412
> > > ( if in_accepting_state(L) % line 413
> > > then Token = L ^ clxm_token
> > > else live_lexeme_in_accepting_state(Ls, Token) % line 415
> > > ).
> > >
> > > If the called predicate `in_accepting_state' is placed in module `lex'
> > > all works fine. Difficulties arise immediately when I place
> > > `in_accepting_state' into the separate sub-module `lex__lexeme'. In
> > > this case the following error occurs:
> > >
> > > lex.m:415: In clause for `live_lexeme_in_accepting_state(in((lex:live_lexeme_list)), out((lex:annotated_token)))':
> > > lex.m:415: mode error in conjunction. The next 2 error messages
> > > lex.m:415: indicate possible causes of this error.
> > > lex.m:413: In clause for `live_lexeme_in_accepting_state(in((lex:live_lexeme_list)), out((lex:annotated_token)))':
> > > lex.m:413: in argument 1 of call to predicate `lex:lexeme:in_accepting_state/1':
> > > lex.m:413: mode error: variable `L' has instantiatedness `bound((lex:lexeme):compiled_lexeme(bound((lex:ignore) ; lex:t((func((ground -> ground)) = (free -> ground) is det))), ground, ground))',
> > > lex.m:413: expected instantiatedness was `(lex:live_lexeme)'.
> > >
> > > What is strange in that error message is that both modes:
> > > `(lex:live_lexeme)'
> > > and
> > > `bound((lex:lexeme):compiled_lexeme(bound((lex:ignore) ; lex:t((func((ground -> ground)) = (free -> ground) is det))), ground, ground))'
> > > are exactly the same !
It's a bit hard to tell exactly what the problem is without seeing the
complete source.
But this could occur if you have a type error in the pred declaration
for `in_accepting_state', for example if you declared the argument to have type
`T' rather than type `live_lexeme(T)'. The module qualifiers on the constructor
names in bound insts are determined by the module qualifier on the corresponding
type. If the corresponding type is a type variable, then the module qualifiers
won't get filled in automatically. Try fully module-qualifying all the
constructor names in your bound insts.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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