[Haskell-cafe] Non-existing types in existential quantification?

Henning Thielemann lemming at henning-thielemann.de
Fri Oct 1 09:27:11 EDT 2010


Given the following code, that is accepted by GHC:

> data Exist = forall a. Exist a
>
> exist :: Exist
> exist = Exist undefined

What type has the 'undefined' ?

So far I assumed that at runtime all objects have a concrete type. This 
seems not to be true.

I can also write

> data ExistList = forall a. ExistList [a]
>
> exist :: ExistList
> exist = ExistList []

where I do not need an 'undefined'.


More information about the Haskell-Cafe mailing list