Ticket #1108 (closed defect: fixed)

Opened 9 years ago

Last modified 9 years ago

Add Eq instances for all of Graphics.UI.Gtk.Gdk.Enums

Reported by: guest Owned by: somebody
Priority: normal Milestone:
Component: general (Gtk+, Glib) Version: 0.9.12
Keywords: Cc: jleedev@…


None of the enumerations in Gdk.Enums are instances of Eq, which makes it cumbersome to check for certain events. For example, I wanted to keep track of the fullscreen state of a window with the following code:

ref <- newIORef False
onWindowState win $ \WindowState { eventWindowState = state } -> do
    writeIORef ref (WindowStateFullscreen `elem` state)
    return True

However, writing the code this way requires an Eq instance; workarounds require either manually defining one or using pattern matching, which is cumbersome because state is a list of WindowState values.

It would be trivial to add deriving (Eq) to these enumerations (and also Read/Show, for debugging purposes).

Change History

Changed 9 years ago by axel

  • status changed from new to closed
  • resolution set to fixed

Done. I didn't add Read since I think this incurs quite a lot of code with no real benefit.

Note: See TracTickets for help on using tickets.