* Converted UrgencyHooks to simple Window -> X () functions [patch]

1 patch for repository http://code.haskell.org/XMonadContrib: Fri May 4 10:38:29 EST 2012 gopsychonauts@gmail.com * Converted UrgencyHooks to simple Window -> X () functions Previously, UrgencyHooks were members of the typeclass UrgencyHook, and had to implement Read and Show instances. This was for historical reasons, as originally the UrgencyHook was stored as a layout modifier. Changes in the module's implementation---it now uses handleEventHook and logHook instead---mean that those constraints are no longer needed. Thus, changing the UrgencyHook to a simpler single type is possible. This makes writing new UrgencyHooks simpler, as now they're just functions and don't require a whole new typeclass instance. It also allows for useful behaviour such as UrgencyHook being a Monoid: this increases cohesion in an XConfig definition since multiple UrgencyHooks may now be combined with <+>, just as manageHook and logHook may be. Regrettably, this does break compatibility with any previously-defined custom urgency hooks, since the UrgencyHook typeclass no longer exists.

On Thu, May 3, 2012 at 8:47 PM, David McLean
Regrettably, this does break compatibility with any previously-defined custom urgency hooks, since the UrgencyHook typeclass no longer exists.
How many configs in the Config Archive does this patch break? -- gwern http://www.gwern.net

On 4 May 2012 11:14, Gwern Branwen
On Thu, May 3, 2012 at 8:47 PM, David McLean
wrote: Regrettably, this does break compatibility with any previously-defined custom urgency hooks, since the UrgencyHook typeclass no longer exists.
How many configs in the Config Archive does this patch break?
Since the urgency hooks are now values, and not types, the old hook names (FocusHook, NoUrgencyHook, etc.) no longer exist. Thus, all the configurations specifying any such hook name now fail. Of the darcs XMonad configurations, six of ten will be broken. Which I'll admit is not great. However, none of these configurations have defined any custom UrgencyHook instances, so the changes required are fairly minor, in some cases just changing the capitalisation to reference value rather than type.

On Thu, May 3, 2012 at 9:35 PM, David McLean
Of the darcs XMonad configurations, six of ten will be broken. Which I'll admit is not great. However, none of these configurations have defined any custom UrgencyHook instances, so the changes required are fairly minor, in some cases just changing the capitalisation to reference value rather than type.
$ g -l [^\.]Hook *.hs|sort -u|wc 68 68 399 Yeah, I'm not pushing a patch breaking 68 configs without a lot more feedback from Xmonaders in general. -- gwern http://www.gwern.net

Gwern Branwen [2012.05.03 2213 -0400]:
On Thu, May 3, 2012 at 9:35 PM, David McLean
wrote: Of the darcs XMonad configurations, six of ten will be broken. Which I'll admit is not great. However, none of these configurations have defined any custom UrgencyHook instances, so the changes required are fairly minor, in some cases just changing the capitalisation to reference value rather than type.
$ g -l [^\.]Hook *.hs|sort -u|wc 68 68 399
Yeah, I'm not pushing a patch breaking 68 configs without a lot more feedback from Xmonaders in general.
It would certainly also break my config, even though it's not published anywhere, and I would suspect that I'm by far not the only xmonad user who doesn't publish his config. My reaction to this patch is: I'm willing to live with the breakage (since it's a one-time fix I need to apply to my xmonad.hs) under two conditions: * We're convinced that the change this patch introduces is beneficial in the long run (I'm semi-convinced by the patch message that this is the case). * The patch author should make sure that all uses of urgency hooks in the darcs repository get converted to the new interface. (When I worked on my (for now on hold) rewrite of the Decoration module, I went through all modules that used it and made sure they work.) I think it would be a very bad idea to have broken config examples in the repository. Cheers, Norbert
participants (3)
-
David McLean
-
Gwern Branwen
-
Norbert Zeh