[Xmonad] darcs patch: simplify shift, removing unneeded check.

Donald Bruce Stewart dons at cse.unsw.edu.au
Tue Jun 26 00:13:46 EDT 2007


droundy:
> Just a little cleanup...
> 
> Sun Jun 24 08:08:51 PDT 2007  David Roundy <droundy at darcs.net>
>   * simplify shift, removing unneeded check.
> 

Content-Description: A darcs patch for your repository!
> 
> New patches:
> 
> [simplify shift, removing unneeded check.
> David Roundy <droundy at darcs.net>**20070624150851] 
> <
> > {
> hunk ./StackSet.hs 479
>  -- The actual focused workspace doesn't change. If there is -- no
>  -- element on the current stack, the original stackSet is returned.
>  --
> -shift :: (Ord a, Eq s, Integral i) => i -> StackSet i a s -> StackSet i a s
> -shift n s = if and [n >= 0,n `tagMember` s, n /= tag (workspace (current s))]
> +shift :: (Ord a, Eq s, Eq i) => i -> StackSet i a s -> StackSet i a s
> +shift n s = if n `tagMember` s && n /= tag (workspace (current s))
>              then maybe s go (peek s) else s
>      where go w = foldr ($) s [view (tag (workspace (current s))),insertUp w,view n,delete w]
>                             --  ^^ poor man's state monad :-)
> }


Incorrect type ?

/home/dons/bin/ghc -I/usr/obj/cabal -o /usr/obj/cabal/xmonad/xmonad --make -hide-all-packages -i -i/usr/obj/cabal/autogen -i. -odir /usr/obj/cabal/xmonad/xmonad-tmp -hidir /usr/obj/cabal/xmonad/xmonad-tmp -package base-2.0 -package X11-1.2.2 -package X11-extras-0.2 -package mtl-1.0 -package unix-1.0 -funbox-strict-fields -O2 -fasm -Wall -optl-Wl,-s -fglasgow-exts Main.hs
[1 of 6] Compiling StackSet         ( StackSet.hs, /usr/obj/cabal/xmonad/xmonad-tmp/StackSet.o )

StackSet.hs:487:83:
    Could not deduce (Integral i) from the context (Ord a, Eq s, Eq i)
      arising from use of `delete' at StackSet.hs:487:83-90
    Possible fix: add (Integral i) to the type signature(s) for `shift'
    In the expression: delete w
    In the third argument of `foldr', namely
    `[view (tag (workspace (current s))), insertUp w, view n,
      delete w]'
    In the expression:
    foldr
      ($)
      s
      [view (tag (workspace (current s))), insertUp w, view n, delete w]


Or it depends on your 'delete' patch?

-- Don


More information about the Xmonad mailing list