[mercury-users] Existential types and list.map

Peter Hawkins peter at hawkins.emu.id.au
Fri Jul 29 13:08:57 AEST 2005


Mark Brown wrote:

>This is not type safe because there is nothing in the signature of get_thing
>that guarantees that all of the elements in list Y have the same type.  To
>build such a list you would need to have get_thing return a structure that
>contains an existentially typed value.  For example, the signature for
>get_thing could be:
>
>	:- func get_thing(int) = univ.
>
>Then Y would have type list(univ), which would be okay.
>
>  
>
Yes, but I want to put typeclass constraints on the resulting type, so I 
can't use univ. As far as I can see, my only option is to define a new 
list type, which is just hideous.

=)
Peter
--------------------------------------------------------------------------
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