Also, the two definitions for liftGW are exactly equivalent.  You have:

liftGW (GridWidget label) f = f label
liftGW (GridWidget textView) f = f textView

The only difference between the two is name to which the data
parameter to GridWidget is bound, which doesn't change the meaning at
all.  You should properly have

liftGW (GridWidget widget) f = f widget

There's no way to determine if that widget is a label or textView,
which is the whole point of existential types.

Cheers,
John

> From: Miguel Mitrofanov <miguelim...@yandex.ru>
> Subject: Re: [Haskell-cafe] Problem on existential type.
> To: Magicloud Magiclouds <magicloud.magiclo...@gmail.com>
>
> 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:-------------+
>
>> liftGW :: (GridWidget widget) -> (widget -> t) -> t
>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to