wiki:ExistentialTypeSynonyms

Version 1 (modified by john@…, 8 years ago) (diff)

--

allow extensential type synonyms, so if you had something like the following,

data Type a = ....

you could declare a synonym such as

type AnyType = exists a . Type a

so you can create functions such as

areSame :: AnyType -> AnyType -> Bool

which would expand to

areSame :: forall a b . Type a -> Type b -> Bool

this is not to be confused with the currently allowed in ghc

type AllTypes = forall a . Type a

oddFunc :: AllTypes -> AllTypes -> Bool

which expands to the rank 2 type

oddFunc :: (forall a . Type a) -> (forall b . Type b) -> Bool

which means something quite different.

Pro

  • if we use 'exists' for existential types, this seems like a natural use of said keyword too.