How to apply (withWorkspace myXPConfig) to two functions?

I'm trying to write a function that asks for a workspace name, then sends the current window there and views it. Like these: carryToNext = shiftTo Next NonEmptyWS >> moveToNext carryToPrev = shiftTo Prev NonEmptyWS >> moveToPrev except with a specific workspace. I've got it almost working, but it asks for the workspace twice: carryToSpecific = withWorkspace myXPConfig (windows . W.shift) >> withWorkspace myXPConfig (windows . W.greedyView) There should be some simple way to combine the two, but I'm not sure how to go about finding it. A few things I've tried: carryToSpecific = withWorkspace myXPConfig ((windows . W.shift) >> (windows . W.greedyView)) carryToSpecific = withWorkspace myXPConfig (windows . (W.shift >> W.greedyView)) carryToSpecific = map (withWorkspace myXPConfig) [(windows . W.shift), (windows . W.greedyView)] carryToSpecific = do ws <- withWorkspace myXPConfig return ws $ windows . W.shift ws $ windows . W.greedyView return () What's the proper way? Thanks Jeff

On Wed, Oct 10, 2012 at 10:35 AM, Jeffrey David Johnson
I'm trying to write a function that asks for a workspace name, then sends the current window there and views it. carryToSpecific = withWorkspace myXPConfig (windows . W.shift) >> withWorkspace myXPConfig (windows . W.greedyView)
Something along the lines of carryToSpecific = withWorkspace myXPConfig (\ws -> windows $ W.greedyView ws . W.shift ws) -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix/linux, openafs, kerberos, infrastructure http://sinenomine.net

Thanks! That did it. Solutions in Haskell are always so simple, once you see them. Jeff On 10/10/12 07:43, Brandon Allbery wrote:
On Wed, Oct 10, 2012 at 10:35 AM, Jeffrey David Johnson
mailto:jefdaj@gmail.com> wrote: I'm trying to write a function that asks for a workspace name, then sends the current window there and views it. carryToSpecific = withWorkspace myXPConfig (windows . W.shift) >> withWorkspace myXPConfig (windows . W.greedyView)
Something along the lines of
carryToSpecific = withWorkspace myXPConfig (\ws -> windows $ W.greedyView ws . W.shift ws)
-- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com mailto:allbery.b@gmail.com ballbery@sinenomine.net mailto:ballbery@sinenomine.net unix/linux, openafs, kerberos, infrastructure http://sinenomine.net
participants (2)
-
Brandon Allbery
-
Jeffrey David Johnson