[Haskell-cafe] more gtk help

Claude Heiland-Allen claude at mathr.co.uk
Mon Aug 12 15:50:43 CEST 2013


Hi Brian,

On 12/08/13 03:52, briand at aracnet.com wrote:
...
>     Couldn't match expected type
...
>       Gtk.on Gtk.exposeEvent glCanvas $ \ _ -> putStrLn "foo"
...
> I looked up the type of Gtk.on and exposeEvent :
...
> on
>   :: object
>      -> Signal object callback -> callback -> IO (ConnectId object)
...

I think you have the arguments flipped, try:

Gtk.on glCanvas Gtk.exposeEvent $ \_ -> ...


As for explaining the types - as I understand it, you have an object and
a callback, and the Signal associates the object with the callback for a
specific event type.  The type variables occur more than once in the
whole type for safety: the right type of callback must be provided for
the event type, and the object must support the event type too.


Claude
-- 
http://mathr.co.uk





More information about the Haskell-Cafe mailing list