
Thank you all guys. This explained so much.
On Sun, Sep 6, 2009 at 2:53 AM, Ryan Ingram
On Thu, Sep 3, 2009 at 11:05 PM, Magicloud Magiclouds
wrote: data GridWidget = forall widget. (WidgetClass widget) => GridWidget widget
liftGW :: (GridWidget widget) -> (widget -> t) -> t liftGW (GridWidget label) f = f label liftGW (GridWidget textView) f = f textView
The type signature on liftGW is wrong. Also, as mentioned elsewhere, the two matches overlap; the second case never gets called.
The correct type signature for "liftGW" is:
liftGW :: GridWidget -> (forall widget. WidgetClass widget => widget -> t) -> t
Note that the "f" passed in has to accept *any* widget type, so it's possible that existential types aren't what you want.
-- ryan
-- 竹密岂妨流水过 山高哪阻野云飞