[xmonad] darcs patch: Refactor XMonad.Hooks.DynamicLog

Roman Cheplyaka roma at ro-che.info
Wed Feb 20 10:53:21 EST 2008


* Brent Yorgey <byorgey at gmail.com> [2008-02-20 10:43:06-0500]
> On Wed, Feb 20, 2008 at 10:30 AM, Roman Cheplyaka <roma at ro-che.info> wrote:
> 
> > * Spencer Janssen <sjanssen at cse.unl.edu> [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 <roma at ro-che.info>
> > > >   * 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.

The equation
> dynamicLogWithPP pp = dynamicLogString pp >>= io . ppOutput pp
shows that performing action on dynamicLogString's result is essentially
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...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/xmonad/attachments/20080220/77ad5a64/attachment.bin


More information about the xmonad mailing list