[Haskell-cafe] Problem on existential type.

Jochem Berndsen jochem at functor.nl
Fri Sep 4 03:14:52 EDT 2009

Miguel Mitrofanov wrote:
> Your data type GridWidget doesn't have a parameter, yet you use it like
> it has one.
>> data GridWidget = forall widget. (WidgetClass widget) => GridWidget
>> widget
>                 ^
>                 |
> NB:-------------+

This is allowed as long as you have enabled the ExistentialTypes
extension. This declares a so-called existential type, see the wiki for
details, http://www.haskell.org/haskellwiki/Existential_types .

Note that the second occurrence of "GridWidget" defines a data
constructor, not a type constructor.

Cheers, Jochem

Jochem Berndsen | jochem at functor.nl

More information about the Haskell-Cafe mailing list