From 9fafa995c7fa00781359b99ffba3714c1697a3f4 Mon Sep 17 00:00:00 2001 From: Don Stewart Date: Mon, 30 Apr 2007 02:45:25 +0000 Subject: [PATCH] shrink 'rotate' a little --- StackSet.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/StackSet.hs b/StackSet.hs index b052141..73c3bfb 100644 --- a/StackSet.hs +++ b/StackSet.hs @@ -143,10 +143,8 @@ rotate :: (Integral i, Eq a) => Ordering -> StackSet i j a -> StackSet i j a rotate o w = maybe w id $ do f <- M.lookup (current w) (focus w) s <- M.lookup (current w) (stacks w) - ea <- case o of - EQ -> Nothing - GT -> elemAfter f s - LT -> elemAfter f (reverse s) + ea <- case o of EQ -> Nothing + _ -> elemAfter f (if o == GT then s else reverse s) return $ w { focus = M.insert (current w) ea (focus w) } -- | /O(log n)/. shift. move the client on top of the current stack to