Re: Problem on existential type.

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
Subject: Re: [Haskell-cafe] Problem on existential type. To: Magicloud Magiclouds 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
participants (1)
-
John Lato