summaryrefslogtreecommitdiffstats
path: root/StackSet.hs
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-06-26 05:32:02 +0200
committerDon Stewart <dons@cse.unsw.edu.au>2007-06-26 05:32:02 +0200
commit79eb08f932e9671289207d5cfe02063a64f70575 (patch)
treebee99da07bd750c6e206fdc9290ab571a7e87b7f /StackSet.hs
parent9d718cd31b28f6799fd2dd25ffe17d9032dadbda (diff)
downloadmetatile-79eb08f932e9671289207d5cfe02063a64f70575.tar
metatile-79eb08f932e9671289207d5cfe02063a64f70575.zip
clean up 'StackSet.filter' for style
darcs-hash:20070626033202-9c5c1-2c9b63321755af27ab1e00c97e82104ca94bf558
Diffstat (limited to 'StackSet.hs')
-rw-r--r--StackSet.hs8
1 files 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.