From ee21ee2e74b4184e5c51de0e2b96c1c19aecf556 Mon Sep 17 00:00:00 2001 From: Spencer Janssen Date: Mon, 4 Jun 2007 20:22:28 +0200 Subject: Simplify focusUp/Down darcs-hash:20070604182228-a5988-4114dc5f3d0c5533f66cb2c34e2f3fe9566f19e0.gz --- StackSet.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'StackSet.hs') diff --git a/StackSet.hs b/StackSet.hs index bb581d2..8f8c4e3 100644 --- a/StackSet.hs +++ b/StackSet.hs @@ -272,14 +272,12 @@ index = with [] integrate -- focusUp, focusDown, swapUp, swapDown :: StackSet i a s -> StackSet i a s focusUp = modify Empty $ \c -> case c of - Node _ [] [] -> c Node t (l:ls) rs -> Node l ls (t:rs) - Node t [] rs -> Node x (xs ++ [t]) [] where (x:xs) = reverse rs + Node t [] rs -> Node x xs [] where (x:xs) = reverse (t:rs) focusDown = modify Empty $ \c -> case c of - Node _ [] [] -> c Node t ls (r:rs) -> Node r (t:ls) rs - Node t ls [] -> Node x [] (xs ++ [t]) where (x:xs) = reverse ls + Node t ls [] -> Node x [] xs where (x:xs) = reverse (t:ls) swapUp = modify Empty $ \c -> case c of Node _ [] [] -> c -- cgit v1.2.3