[mercury-users] Existential types and if-then-else
Dominique de Waleffe
ddw at miscrit.be
Thu Oct 7 18:10:44 AEST 1999
> -----Original Message-----
> From: owner-mercury-users at cs.mu.OZ.AU
> [mailto:owner-mercury-users at cs.mu.OZ.AU]On Behalf Of Fergus Henderson
> Sent: Thursday, October 07, 1999 6:19 AM
> To: mercury-users at cs.mu.OZ.AU
> Subject: Re: [mercury-users] Existential types and if-then-else
>
>
> On 06-Oct-1999, Peter Ross <petdr at cs.mu.OZ.AU> wrote:
> > Here is an existential type problem that I encountered today.
> >
> > Basically if you have some semidet predicate which returns an
> > existential type, T, you want to store that type in a maybe-like type
> > that has T in it if the predicate is succesful or indicates
> > that the predicate has failed.
> >
> > exist1.m uses maybe(T) with the existential quantification on the
> > predicates.
[stuff deleted]
> Here's what the compiuler reports:
> exist.m:027: In clause for `p(out)':
> exist.m:027: in call to predicate `exist:q/2':
> exist.m:027: scope error: attempt to bind a non-local variable
> exist.m:027: inside the condition of an if-then-else.
> exist.m:027: Variable `TypeClassInfo_for_tc' has
> instantiatedness `free',
> exist.m:027: expected instantiatedness was `ground'.
>
> The compiler is right to reject this predicate, because if q/2
> were to fail,
> then there would be no binding for the type variable T1.
I do not reject the fact that the compiler is right. However, as a user, I
cannot see the 'TypeClassInfo_for_tc' anywhere in the program therefore I do
not know how to interpret this message.
I also have difficulties interpreting messages like:
"variable V has type `Out' , type `Out' was expected"
which we've got at some point trying to figure out a way around the other
problem....
The problem is that the module generated for supporting the COM stuff
contains many instances of type variables, which have the same name at
different predicate/typeclass definitions like Out....
Thus names of type variables should probably be decorated to include a hint
as to where they come from....
D.
--------------------------------------------------------------------------
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