[Haskell] existential type synonyms

John Meacham john at repetae.net
Mon Dec 12 22:27:53 EST 2005

I was wondering if this would make sense

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

> 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 opposed to 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.

if we use 'exists' for existential types, this might be another useful
use of said name.


John Meacham - ⑆repetae.net⑆john⑈ 

More information about the Haskell mailing list