From 5afccb9ca64e30a6c0eadfe8435ba9917fb4a214 Mon Sep 17 00:00:00 2001 From: David Roundy Date: Thu, 20 Sep 2007 23:01:43 +0200 Subject: eliminate a few Eq a constraints in StackSet. darcs-hash:20070920210143-72aca-9d96136d8558d8a52064f856de06e543aa0e75a7 --- StackSet.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/StackSet.hs b/StackSet.hs index b9b1aa1..501e99f 100644 --- a/StackSet.hs +++ b/StackSet.hs @@ -38,7 +38,7 @@ module StackSet ( import Prelude hiding (filter) import Data.Maybe (listToMaybe,fromJust) -import qualified Data.List as L (delete,deleteBy,find,splitAt,filter) +import qualified Data.List as L (deleteBy,find,splitAt,filter) import qualified Data.Map as M (Map,insert,delete,empty) -- $intro @@ -225,7 +225,7 @@ new _ _ = abort "non-positive argument to StackSet.new" -- becomes the current screen. If it is in the visible list, it becomes -- current. -view :: (Eq a, Eq s, Eq i) => i -> StackSet i a s sd -> StackSet i a s sd +view :: (Eq s, Eq i) => i -> StackSet i a s sd -> StackSet i a s sd view i s | not (i `tagMember` s) || i == tag (workspace (current s)) = s -- out of bounds or current @@ -237,10 +237,11 @@ view i s | Just x <- L.find ((i==).tag) (hidden s) -- if it was hidden, it is raised on the xine screen currently used = s { current = (current s) { workspace = x } - , hidden = workspace (current s) : L.delete x (hidden s) } + , hidden = workspace (current s) : L.deleteBy tagEq x (hidden s) } | otherwise = s where screenEq x y = screen x == screen y + tagEq x y = tag x == tag y -- 'Catch'ing this might be hard. Relies on monotonically increasing -- workspace tags defined in 'new' @@ -253,7 +254,7 @@ view i s -- screen, the workspaces of the current screen and the other screen are -- swapped. -greedyView :: (Eq a, Eq s, Eq i) => i -> StackSet i a s sd -> StackSet i a s sd +greedyView :: (Eq s, Eq i) => i -> StackSet i a s sd -> StackSet i a s sd greedyView w ws | any wTag (hidden ws) = view w ws | (Just s) <- L.find (wTag . workspace) (visible ws) -- cgit v1.2.3