
5 Sep
2009
5 Sep
'09
6:53 p.m.
On Thu, Sep 3, 2009 at 11:05 PM, Magicloud
Magiclouds
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