[xmonad] Haskell question: avoiding code duplication

Brandon Allbery allbery.b at gmail.com
Sat Feb 2 19:30:36 CET 2013


On Sat, Feb 2, 2013 at 1:08 PM, Peter Jones <mlists at pmade.com> wrote:

> The last two lines demonstrate the pattern I've been seeing.  The only
> way I know how to remove this duplication is to move it out into a
> top-level function.  Is that correct?
>

You might instead wrap your hook in

    doEvent :: (Event -> X a) -> X All
    doEvent act = \e -> act e >> idHook -- or pointfree:  (>> idHook) . act

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20130202/1a9779fe/attachment.htm>


More information about the xmonad mailing list