
17 May
2007
17 May
'07
10:16 p.m.
Hi
* new relies on the Integral type having sensible semantics, if you pass Int or Integer its fine (machine checked), but if you create a crazy type, make it an instance of Integral then [0..n-1] may generate no elements, and your (h:t) match will fail.
Tricky.
You can fix this with: where (h:ts) = Workspace 0 Empty : [ Workspace i Empty | i <- [1 ..n-1]] or: new n m | n > 0 && m > 0 = StackSet n (Workspace 0 Empty) [] ts xine where ts = [ Workspace i Empty | i <- [1 ..n-1]] Either one will guarantee safety. Of course, you can just have Catch check this property only on Int - however you no longer have a proof that XMonad is safe - depends how important that "verified by Catch" button is (button coming soon!). Thanks Neil