[mercury-users] Existential types and if-then-else

David Overton dmo at hydra.cs.mu.oz.au
Thu Oct 7 02:39:27 AEST 1999


On Thu, 07 Oct, 1999 at 02:23:06AM EST, Peter Ross wrote:
> Hi,
> 
> 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.
> 
> exist2.m works by getting rid of the if_then_else
> 
> exist3.m uses maybe which has an existentially typed data constructor.
> 

Just to add to what Pete has written:  I think exist3.m should work,
but I get the following error when I try it:

exist3.m:012: In clause for `'__Unify__'(in, in)':
exist3.m:012:   mode error in unification of `V_1' and
		`exist3:yes(TypeClassInfo_for_tc, V_3)'.
exist3.m:012:   Variable `V_1' has instantiatedness
		`bound(exist3:yes(ground))',
exist3.m:012:   term `exist3:yes(TypeClassInfo_for_tc, V_3)'
exist3.m:012:   has instantiatedness `exist3:yes(free, free)'.

Any ideas?

David
-- 
David Overton       Department of Computer Science & Software Engineering
PhD Student         The University of Melbourne, Australia
+61 3 9344 9159     http://www.cs.mu.oz.au/~dmo
--------------------------------------------------------------------------
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