diff options
author | Neil Mitchell <gentoo-haskell@vcs.intern> | 2007-05-24 01:32:12 +0200 |
---|---|---|
committer | Neil Mitchell <gentoo-haskell@vcs.intern> | 2007-05-24 01:32:12 +0200 |
commit | 0252be477022ddb6a85908a88c75c534e3a286e4 (patch) | |
tree | f0ad4dd3a3387b678eee60a11514bebb8ffde5e4 /StackSet.hs | |
parent | 2d841b3222bbee5ab5a7c7a7115b70f6711242ee (diff) | |
download | xmonad-0252be477022ddb6a85908a88c75c534e3a286e4.tar.gz xmonad-0252be477022ddb6a85908a88c75c534e3a286e4.tar.xz xmonad-0252be477022ddb6a85908a88c75c534e3a286e4.zip |
Add an abort function, called for deliberate and intentional errors
darcs-hash:20070523233212-73ab9-81ab782d6360e1d85152c647f9c7cd19a065963a.gz
Diffstat (limited to '')
-rw-r--r-- | StackSet.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/StackSet.hs b/StackSet.hs index b00c67e..68d56e8 100644 --- a/StackSet.hs +++ b/StackSet.hs @@ -146,6 +146,10 @@ data Stack a = Empty , right :: [a] } -- jokers to the right deriving (Show, Read, Eq) + +-- this function indicates to catch that an error is expected +abort x = error x + -- --------------------------------------------------------------------- -- Construction @@ -157,7 +161,7 @@ data Stack a = Empty -- new :: (Integral i, Integral s) => i -> s -> StackSet i a s new n m | n > 0 && m > 0 = StackSet n cur visi unseen - | otherwise = error "non-positive arguments to StackSet.new" + | otherwise = abort "non-positive arguments to StackSet.new" where (seen,unseen) = L.genericSplitAt m $ Workspace 0 Empty : [ Workspace i Empty | i <- [1 ..n-1]] (cur:visi) = [ Screen i s | (i,s) <- zip seen [0..] ] @@ -187,7 +191,7 @@ view i s = s { current = Screen x (screen (current s)) , hidden = workspace (current s) : L.delete x (hidden s) } - | otherwise = error "Inconsistent StackSet: workspace not found" + | otherwise = abort "Inconsistent StackSet: workspace not found" -- 'Catch'ing this might be hard. Relies on monotonically increasing -- workspace tags defined in 'new' |