#1108: Add Eq instances for all of Graphics.UI.Gtk.Gdk.Enums
----------------------------------+-----------------------------------------
Reporter: guest | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: general (Gtk+, Glib) | Version: 0.9.12
Keywords: |
----------------------------------+-----------------------------------------
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).
--
Ticket URL: <http://hackage.haskell.org/trac/gtk2hs/ticket/1108>
Gtk2Hs <http://haskell.org/gtk2hs/>
The Gtk2Hs project
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Gtk2hs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel