diff options
author | Don Stewart <dons@cse.unsw.edu.au> | 2007-04-29 05:58:04 +0200 |
---|---|---|
committer | Don Stewart <dons@cse.unsw.edu.au> | 2007-04-29 05:58:04 +0200 |
commit | b510eb1321800274da9d6e38ec89ced9c46b8430 (patch) | |
tree | b1ec6aababd481bd4cc87766eeea7ff7bafc9e18 | |
parent | 912a3cfce1846fdc2e956388b5ebd3a5ad69c143 (diff) | |
download | metatile-b510eb1321800274da9d6e38ec89ced9c46b8430.tar metatile-b510eb1321800274da9d6e38ec89ced9c46b8430.zip |
move fromList into Properties.hs, -17 loc
darcs-hash:20070429035804-9c5c1-6e23a1c166235085f34bda111b332b2ef7b50e01
-rw-r--r-- | StackSet.hs | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/StackSet.hs b/StackSet.hs index f7ab36f..d3d08cb 100644 --- a/StackSet.hs +++ b/StackSet.hs @@ -24,13 +24,13 @@ module StackSet ( StackSet(..), -- abstract screen, peekStack, index, empty, peek, push, delete, member, - raiseFocus, rotate, promote, shift, view, workspace, fromList, + raiseFocus, rotate, promote, shift, view, workspace, insert, size, visibleWorkspaces, swap {- helper -} ) where import Data.Maybe -import qualified Data.List as L (delete,genericLength,elemIndex) -import qualified Data.Map as M +import qualified Data.List as L (delete,elemIndex) +import qualified Data.Map as M ------------------------------------------------------------------------ @@ -79,23 +79,6 @@ size = M.size . stacks ------------------------------------------------------------------------ --- | fromList. Build a new StackSet from a list of list of elements, --- keeping track of the currently focused workspace, and the total --- number of workspaces. If there are duplicates in the list, the last --- occurence wins. -fromList :: (Integral i, Integral j, Ord a) => (i, Int,[[a]]) -> StackSet i j a -fromList (_,_,[]) = error "Cannot build a StackSet from an empty list" - -fromList (n,m,xs) | n < 0 || n >= L.genericLength xs - = error $ "Cursor index is out of range: " ++ show (n, length xs) - | m < 1 || m > L.genericLength xs - = error $ "Can't have more screens than workspaces: " ++ show (m, length xs) - -fromList (o,m,xs) = view o $ foldr (\(i,ys) s -> - foldr (\a t -> insert a i t) s ys) - (empty (length xs) m) (zip [0..] xs) - - -- | Push. Insert an element onto the top of the current stack. -- If the element is already in the current stack, it is moved to the top. -- If the element is managed on another stack, it is removed from that |