Reduce head usage

This commit is contained in:
Tony Zorman
2023-10-15 12:29:56 +02:00
parent 7680ebb93b
commit 46a26487ba
10 changed files with 28 additions and 25 deletions

View File

@@ -80,11 +80,9 @@ applyPosition :: (LayoutClass l a, Eq a) =>
applyPosition pos wksp rect = do
let stack = W.stack wksp
let ws = W.integrate' stack
if null ws then
runLayout wksp rect
else do
let firstW = head ws
let other = drop 1 ws
case ws of
[] -> runLayout wksp rect
(firstW : other) -> do
let filtStack = stack >>= W.filter (firstW /=)
wrs <- runLayout (wksp {W.stack = filtStack}) rect
return $ first ((firstW, place pos other rect) :) wrs

View File

@@ -91,7 +91,7 @@ instance (LayoutClass l (), LayoutClass l1 a, LayoutClass l2 a, Read a, Show a,
handleMessage super (SomeMessage ReleaseResources)
return ([(w,rinput)], Just $ C2 [w] [w] super' l1' l2')
arrange origws =
do let w2' = case origws `intersect` w2 of [] -> [head origws]
do let w2' = case origws `intersect` w2 of [] -> take 1 origws
[x] -> [x]
x -> case origws \\ x of
[] -> init x