Examples of the Worker/Wrapper Transformation

Here are some examples. Feel free to email links to others.

Example Pre-
condition
Fusion Smaller
Type
Original Type New Type
reverse basic W/W Original [a] -> [a] [a] -> [a] -> [a]
Double Barreled
CPS
basic W/W Original Expr -> Maybe Int Expr -> (Int -> Maybe Int)
   -> Maybe Int -> Maybe Int
nub (part 1) basic WW Original [Int] -> [Int] R -> [Int]
memoize fib basic - - Fac -> Fac [Fac]
Arg swap basic - - (a -> b) -> [a] -> [b] [a] -> (a -> b) -> [b]
fac body known-cons New Int -> Int Int# -> Int#
last body known-cons New [a] -> a a -> [a] -> a
nub (part 2) body known-cons New R -> [Int] [Int] -> Set Int -> [Int]
accum fac fix known-cons New Int -> Int -> Int Int# -> Int# -> Int#
isAlive fix Lemma(s):
a2c . c2a = id
New [(Int,Int)] -> (Int,Int) -> Bool Set Int -> Int -> Bool

Emerging patterns, for these examples.