From b510eb1321800274da9d6e38ec89ced9c46b8430 Mon Sep 17 00:00:00 2001 From: Don Stewart Date: Sun, 29 Apr 2007 05:58:04 +0200 Subject: move fromList into Properties.hs, -17 loc darcs-hash:20070429035804-9c5c1-6e23a1c166235085f34bda111b332b2ef7b50e01 --- StackSet.hs | 23 +++-------------------- 1 file 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 -- cgit v1.2.3