From e78a30c2316b3695c4b2506b50fda596ea5fc15e Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 2 Dec 2008 17:17:22 +0000 Subject: [PATCH] Added an applyBottomUp function (non-monadic) --- polyplate/Data/Generics/Polyplate/Schemes.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/polyplate/Data/Generics/Polyplate/Schemes.hs b/polyplate/Data/Generics/Polyplate/Schemes.hs index 7b1fa06..5b1c401 100644 --- a/polyplate/Data/Generics/Polyplate/Schemes.hs +++ b/polyplate/Data/Generics/Polyplate/Schemes.hs @@ -100,6 +100,13 @@ applyBottomUpM f = makeRecurseM ops where ops = baseOp `extOpM` makeBottomUpM ops f +applyBottomUp :: (Polyplate t (OneOp s) (), + Polyplate s () (OneOp s)) => + (s -> s) -> t -> t +applyBottomUp f = makeRecurse ops + where + ops = baseOp `extOp` makeBottomUp ops f + -- | Given a monadic function that applies to a particular type (s), automatically -- applies that function to every instance of s in a larger structure of type t, -- performing the transformations in a top-down fashion. It does a depth first