syb 0.3.6.2 → 0.3.7
raw patch · 2 files changed
+9/−1 lines, 2 files
Files
- src/Data/Generics/Schemes.hs +8/−0
- syb.cabal +1/−1
src/Data/Generics/Schemes.hs view
@@ -27,6 +27,7 @@ somewhere, everything, everythingBut, + everythingWithContext, listify, something, synthesize, @@ -111,6 +112,13 @@ in if stop then v else foldl k v (gmapQ (everythingBut k f) x) + +-- | Summarise all nodes in top-down, left-to-right order, carrying some state +-- down the tree during the computation, but not left-to-right to siblings. +everythingWithContext :: s -> (r -> r -> r) -> GenericQ (s -> (r, s)) -> GenericQ r +everythingWithContext s0 f q x = + foldl f r (gmapQ (everythingWithContext s' f q) x) + where (r, s') = q x s0 -- | Get a list of all entities that meet a predicate listify :: Typeable r => (r -> Bool) -> GenericQ [r]
syb.cabal view
@@ -1,5 +1,5 @@ name: syb -version: 0.3.6.2 +version: 0.3.7 license: BSD3 license-file: LICENSE author: Ralf Lammel, Simon Peyton Jones, Jose Pedro Magalhaes