darcs patch: Refactor XMonad.Hooks.DynamicLog

Mon Feb 11 00:24:06 EET 2008 Roman Cheplyaka

On Mon, Feb 11, 2008 at 12:25:59AM +0200, Roman Cheplyaka wrote:
Mon Feb 11 00:24:06 EET 2008 Roman Cheplyaka
* Refactor XMonad.Hooks.DynamicLog This allows using DynamicLog not only for statusbar.
, ((mod1Mask, xK_a ), sendMessage NextLayout >> (dynamicLogString myPP >>= \d->spawn $"xmessage "++d))
Why not use this instead:
dynamicLogWithPP $ myPP { ppOutput = spawn . ("xmessage "++) }
Just trying to play devil's advocate against API increases here :) Cheers, Spencer Janssen

* Spencer Janssen
On Mon, Feb 11, 2008 at 12:25:59AM +0200, Roman Cheplyaka wrote:
Mon Feb 11 00:24:06 EET 2008 Roman Cheplyaka
* Refactor XMonad.Hooks.DynamicLog This allows using DynamicLog not only for statusbar. , ((mod1Mask, xK_a ), sendMessage NextLayout >> (dynamicLogString myPP >>= \d->spawn $"xmessage "++d))
Why not use this instead:
dynamicLogWithPP $ myPP { ppOutput = spawn . ("xmessage "++) }
Just trying to play devil's advocate against API increases here :)
Yeah, I was blind. Now it seems really pointless. Feel free to unapply it. Would you also edit [1]? 1. http://haskell.org/haskellwiki/Xmonad/Frequently_asked_questions#I_don.27t_u... -- Roman I. Cheplyaka (aka Feuerbach @ IRC)

On Wed, Feb 20, 2008 at 10:30 AM, Roman Cheplyaka
* Spencer Janssen
[2008-02-12 03:58:21-0600] On Mon, Feb 11, 2008 at 12:25:59AM +0200, Roman Cheplyaka wrote:
Mon Feb 11 00:24:06 EET 2008 Roman Cheplyaka
* Refactor XMonad.Hooks.DynamicLog This allows using DynamicLog not only for statusbar. , ((mod1Mask, xK_a ), sendMessage NextLayout >> (dynamicLogString myPP >>= \d->spawn $"xmessage "++d))
Why not use this instead:
dynamicLogWithPP $ myPP { ppOutput = spawn . ("xmessage "++) }
Just trying to play devil's advocate against API increases here :)
Yeah, I was blind. Now it seems really pointless. Feel free to unapply it. Would you also edit [1]?
Personally, I still feel like having dynamicLogString is a nice abstraction -- it decouples the status text generation from the output, and lets you get your hands directly on the status text if you would like. So, it turns out that this particular example can be done more simply using a specialized ppOutput, but that doesn't mean dynamicLogString might not still be useful. -Brent

* Brent Yorgey
On Wed, Feb 20, 2008 at 10:30 AM, Roman Cheplyaka
wrote: * Spencer Janssen
[2008-02-12 03:58:21-0600] On Mon, Feb 11, 2008 at 12:25:59AM +0200, Roman Cheplyaka wrote:
Mon Feb 11 00:24:06 EET 2008 Roman Cheplyaka
* Refactor XMonad.Hooks.DynamicLog This allows using DynamicLog not only for statusbar. , ((mod1Mask, xK_a ), sendMessage NextLayout >> (dynamicLogString myPP >>= \d->spawn $"xmessage "++d))
Why not use this instead:
dynamicLogWithPP $ myPP { ppOutput = spawn . ("xmessage "++) }
Just trying to play devil's advocate against API increases here :)
Yeah, I was blind. Now it seems really pointless. Feel free to unapply it. Would you also edit [1]?
Personally, I still feel like having dynamicLogString is a nice abstraction -- it decouples the status text generation from the output, and lets you get your hands directly on the status text if you would like. So, it turns out that this particular example can be done more simply using a specialized ppOutput, but that doesn't mean dynamicLogString might not still be useful.
dynamicLogWithPP pp = dynamicLogString pp >>= io . ppOutput pp shows that performing action on dynamicLogString's result is essentially
The equation the same as specifying ppOutput, so it isn't just particular example. (That's why I feel myself blind -- I had to notice this...) dynamicLogWithPP doesn't actually use ppOutput, and that's why I like Spencer's solution more. My patch still can be viewed as refactoring, but dynamicLogWithPP can be at least removed from exports not to increase API, and returned back if we ever find it useful. -- Roman I. Cheplyaka :: http://ro-che.info/ ...being in love is totally punk rock...
participants (3)
-
Brent Yorgey
-
Roman Cheplyaka
-
Spencer Janssen