[m-users.] Using existential types

Zoltan Somogyi zoltan.somogyi at runbox.com
Mon May 17 20:19:47 AEST 2021


2021-05-17 20:12 GMT+10:00 "Philippe de Rochambeau" <phiroc at free.fr>:
> Hello,could someone please explain the advantages of using existential types
> (some) in predicates as opposed to universal types?Many thanks.Best regards,

It is not question of "which is better"; they have totally different roles.
Universal types implement parametric polymorphism (the same operation
applies to all types the same way), while existential types can help implement
non-parametric polymorphism (an operation applies only to a specified set
of types, and may be implemented differently for different types).

People whose programming style is mostly based on functional and
logic programming tend to use parametric polymorphism almost exclusively,
because they tend to use algebraic data types instead of non-parametric
polymorphism. People whose programming style is mostly based on
object oriented programming tend to use non-parametric polymorphism,
because until recently, the popular OO languages did not support either
parametric polymorphism or algebraic data types :-(

Zoltan.


More information about the users mailing list