[Xmonad] statically checked non-empty layout lists

Donald Bruce Stewart dons at cse.unsw.edu.au
Fri May 4 00:16:35 EDT 2007


dons:
> The new layout code introduces more chances for runtime errors than I'd
> like. In particular, the Dynamic type, and the possibility of users
> defining empty layout lists. 

And a patch, just so its archived somewhere.



New patches:

[Use a GADT for non-empty list checking
Don Stewart <dons at cse.unsw.edu.au>**20070504041020] {
hunk ./Config.hs 137
-defaultLayouts :: [Layout]
-defaultLayouts = [ full, tall defaultDelta (1%2), wide defaultDelta (1%2) ]
+defaultLayouts :: List NonEmpty Layout
+defaultLayouts = full .:. tall defaultDelta (1%2) .:. wide defaultDelta (1%2) .:. Nil
hunk ./Config.hs-boot 2
-import XMonad (Layout)
+import XMonad (Layout,List,NonEmpty)
hunk ./Config.hs-boot 4
-defaultLayouts :: [Layout]
+defaultLayouts :: List NonEmpty Layout
hunk ./Main.hs 58
-            , focusedBorder = fbc
-            }
+            , focusedBorder = fbc }
hunk ./Main.hs 61
-            , layouts       = M.empty
-            }
+            , layouts       = M.empty }
hunk ./Operations.hs 51
+
hunk ./Operations.hs 53
+
hunk ./Operations.hs 148
-            fl  = M.findWithDefault defaultLayouts n $ layouts s
+            fl  = M.findWithDefault (toList defaultLayouts) n $ layouts s
hunk ./XMonad.hs 20
-    runX, io, withDisplay, isRoot, spawn, trace, whenJust
+    runX, io, withDisplay, isRoot, spawn, trace, whenJust,
+    toList, List(..), NonEmpty, (.:.)
hunk ./XMonad.hs 103
+data Empty
+data NonEmpty
+
+data List x y where
+     Nil  :: List Empty x
+     Cons :: x -> List y x  -> List NonEmpty x
+
+toList :: List t a -> [a]
+toList Nil          = []
+toList (Cons x y)   = x : toList y
+
+infixr 5 .:.
+(.:.) :: x -> List t x -> List NonEmpty x
+(.:.) = Cons
+
}

Context:

[refactoring, style, comments on new layout code
Don Stewart <dons at cse.unsw.edu.au>**20070504023618] 
[use anyKey constant instead of magic number
Jason Creighton <jcreigh at gmail.com>**20070504015043] 
[added mirrorLayout to mirror arbitrary layouts
Jason Creighton <jcreigh at gmail.com>**20070504014653] 
[Fix layout switching order
Spencer Janssen <sjanssen at cse.unl.edu>**20070503235632] 
[More Config.hs bugs
Spencer Janssen <sjanssen at cse.unl.edu>**20070503234607] 
[Revert accidental change to Config.hs
Spencer Janssen <sjanssen at cse.unl.edu>**20070503233148] 
[Add -fglasgow-exts for pattern guards.  Properties.hs doesn't complain anymore
Spencer Janssen <sjanssen at cse.unl.edu>**20070503214221] 
[Avoid the unsafe pattern match, in case Config.hs has no layouts
Spencer Janssen <sjanssen at cse.unl.edu>**20070503214007] 
[add support for extensible layouts.
David Roundy <droundy at darcs.net>**20070503144750] 
[comments. and stop tracing events to stderr
Don Stewart <dons at cse.unsw.edu.au>**20070503075821] 
[-Wall police
Don Stewart <dons at cse.unsw.edu.au>**20070503074937] 
[elaborate documentation in Config.hs
Don Stewart <dons at cse.unsw.edu.au>**20070503074843] 
[Use updated refreshKeyboardMapping.  Requires latest X11-extras
Spencer Janssen <sjanssen at cse.unl.edu>**20070503032040] 
[run QC tests in addition to LOC test
Jason Creighton <jcreigh at gmail.com>**20070503003202] 
[Add 'mod-n': refreshes current layout
Spencer Janssen <sjanssen at cse.unl.edu>**20070503002252] 
[Fix tests after StackSet changes
Spencer Janssen <sjanssen at cse.unl.edu>**20070502201622] 
[First steps to adding floating layer
Spencer Janssen <sjanssen at cse.unl.edu>**20070502195917] 
[update motivational text using xmonad.org
Don Stewart <dons at cse.unsw.edu.au>**20070502061859] 
[Sort dependencies in installation order
Spencer Janssen <sjanssen at cse.unl.edu>**20070501204249] 
[Recommend X11-extras 0.1
Spencer Janssen <sjanssen at cse.unl.edu>**20070501204121] 
[elaborate description in .cabal
Don Stewart <dons at cse.unsw.edu.au>**20070501035414] 
[use -fasm by default. Much faster
Don Stewart <dons at cse.unsw.edu.au>**20070501031220] 
[Make border width configurable
Spencer Janssen <sjanssen at cse.unl.edu>**20070430163515] 
[Add Config.hs-boot, remove defaultLayoutDesc from XConf
Spencer Janssen <sjanssen at cse.unl.edu>**20070430162647] 
[Comment only
Spencer Janssen <sjanssen at cse.unl.edu>**20070430161635] 
[Comment only
Spencer Janssen <sjanssen at cse.unl.edu>**20070430161511] 
[check we never generate invalid stack sets
Don Stewart <dons at cse.unsw.edu.au>**20070430065946] 
[view n . shift n . view i . shift i) x == x --> shift + view is invertible
Don Stewart <dons at cse.unsw.edu.au>**20070430062901] 
[add rotate all and view idempotency tests
Don Stewart <dons at cse.unsw.edu.au>**20070430055751] 
[Add XConf for values that don't change.
Spencer Janssen <sjanssen at cse.unl.edu>**20070430054715] 
[Control.Arrow is suspicious, add an explicit import
Spencer Janssen <sjanssen at cse.unl.edu>**20070430053623] 
[push is idempotent
Don Stewart <dons at cse.unsw.edu.au>**20070430054345] 
[add two properties relating to empty window managers
Don Stewart <dons at cse.unsw.edu.au>**20070430051016] 
[configurable border colors
Jason Creighton <jcreigh at gmail.com>**20070430043859
 This also fixes a bug where xmonad was assuming a 24-bit display, and just
 using, eg, 0xff0000 as an index into a colormap without querying the X server
 to determine the proper pixel value for "red".
] 
[new QC property: opening a window only affects the current screen
Don Stewart <dons at cse.unsw.edu.au>**20070430050133] 
[a bit more precise about building non-empty stacksets for one test
Don Stewart <dons at cse.unsw.edu.au>**20070430035729] 
[remove redundant call to 'delete' in 'shift'
Don Stewart <dons at cse.unsw.edu.au>**20070430031151] 
[clean 'delete' a little
Don Stewart <dons at cse.unsw.edu.au>**20070430025319] 
[shrink 'swap'
Don Stewart <dons at cse.unsw.edu.au>**20070430024813] 
[shrink 'rotate' a little
Don Stewart <dons at cse.unsw.edu.au>**20070430024525] 
[move size into Properties.hs
Don Stewart <dons at cse.unsw.edu.au>**20070430021758] 
[don't need 'size' operation on StackSet
Don Stewart <dons at cse.unsw.edu.au>**20070430015927] 
[avoid grabbing all keys when a keysym is undefined
Jason Creighton <jcreigh at gmail.com>**20070428180046
 XKeysymToKeycode() returns zero if the keysym is undefined. Zero also happens
 to be the value of AnyKey.
] 
[add homepage: field to .cabal file
Don Stewart <dons at cse.unsw.edu.au>**20070429041011] 
[add fromList to Properties.hs
Don Stewart <dons at cse.unsw.edu.au>**20070429035823] 
[move fromList into Properties.hs, -17 loc
Don Stewart <dons at cse.unsw.edu.au>**20070429035804] 
[Further refactoring
Spencer Janssen <sjanssen at cse.unl.edu>**20070426212257] 
[Refactor in Config.hs (no real changes)
Spencer Janssen <sjanssen at cse.unl.edu>**20070426211407] 
[Add the manpage to extra-source-files
Spencer Janssen <sjanssen at cse.unl.edu>**20070426014105] 
[add xmonad manpage
David Lazar <davidlazar at styso.com>**20070426010812] 
[Remove toList
Spencer Janssen <sjanssen at cse.unl.edu>**20070426005713] 
[Ignore numlock and capslock in keybindings
Jason Creighton <jcreigh at gmail.com>**20070424013357] 
[Clear numlock bit
Spencer Janssen <sjanssen at cse.unl.edu>**20070424010352] 
[force window border to 1px
Jason Creighton <jcreigh at gmail.com>**20070423050824] 
[s/creigh//
Don Stewart <dons at cse.unsw.edu.au>**20070423024026] 
[some other things to do
Don Stewart <dons at cse.unsw.edu.au>**20070423023151] 
[Start TODOs for 0.2
Spencer Janssen <sjanssen at cse.unl.edu>**20070423021526] 
[update readme
Don Stewart <dons at cse.unsw.edu.au>**20070422090507] 
[TAG 0.1
Spencer Janssen <sjanssen at cse.unl.edu>**20070422083033] 
Patch bundle hash:
5e766922308da95a360e50a2a978e76215434b6e


More information about the Xmonad mailing list