[Xmonad] darcs patch: Main.hs: get rid off non-standard patter...
(and 4 more)
joachim.fasting at gmail.com
Wed Jun 20 18:55:01 EDT 2007
On Thursday 21 June 2007 00:44:11 David Roundy wrote:
> On Wed, Jun 20, 2007 at 11:41:25PM +0200, Joachim Fasting wrote:
> > > > > This could be prettier with
> > > > >
> > > > > let winset = maybe (new [0..fromIntegral workspaces-1]
> > > > > (fromIntegral $ length xinesc)) id $ do ("--resume" : s : _) <-
> > > > > args
> > > > > [(x, "")] <- reads s
> > > > > return x
> > > > >
> > > > > which I think is closer to what the pattern guards desugar to.
> > > >
> > > > Your solution is way better than mine. Please pretend like I never
> > > > sent this patch.
> > >
> > > Or you could resubmit with my solution... I'm at work, and while I
> > > can't resist suggesting prettier code, I also have set a hard rule
> > > about not procrastinating by working on xmonad during the day.
> > I would resend using your nice suggestion, but it won't type-check for
> > me.
> Ah, I left out the returns:
> > let winset = maybe (new [0..fromIntegral workspaces-1] (fromIntegral $
> > length xinesc)) id $ do ("--resume" : s : _) <- return $ args
> > [(x, "")] <- return $ reads s
> > return x
Of course, daft of me not to catch that. Nevertheless, it was fun trying to
try doing this the hard way (even learnt something today).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://www.haskell.org/pipermail/xmonad/attachments/20070621/3d79d478/attachment.bin
More information about the Xmonad