From 983c66301f8bf0270ab4462c1272c8e8077c3b61 Mon Sep 17 00:00:00 2001 From: Don Stewart Date: Tue, 26 Jun 2007 05:32:02 +0200 Subject: clean up 'StackSet.filter' for style darcs-hash:20070626033202-9c5c1-2c9b63321755af27ab1e00c97e82104ca94bf558.gz --- StackSet.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/StackSet.hs b/StackSet.hs index 614e95d..e57e80e 100644 --- a/StackSet.hs +++ b/StackSet.hs @@ -303,10 +303,10 @@ differentiate (x:xs) = Just $ Stack x [] xs -- True. Order is preserved, and focus moves to the next node to the right (if -- necessary). filter :: (a -> Bool) -> Stack a -> StackOrNot a -filter p (Stack f ls rs) = case L.filter p (f:rs) of - (f':rs') -> Just $ Stack f' (L.filter p ls) rs' - [] -> do f':rs' <- return $ reverse $ L.filter p ls - Just $ Stack f' [] rs' +filter p (Stack f ls rs) = Just $ case L.filter p (f:rs) of + (f':rs') -> Stack f' (L.filter p ls) rs' + _ -> Stack f' [] rs' + where (f':rs') = reverse (L.filter p ls) -- | -- /O(s)/. Extract the stack on the current workspace, as a list. -- cgit v1.2.3