mirror of
https://github.com/xmonad/xmonad.git
synced 2025-08-02 21:21:52 -07:00
move fromList into Properties.hs, -17 loc
This commit is contained in:
23
StackSet.hs
23
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
|
||||
|
Reference in New Issue
Block a user