module Data.Generics.SYB where
import Data.Generics.Uniplate.Operations
gmapT :: Uniplate a => (a -> a) -> a -> a
gmapT = descend
gmapQl :: Uniplate a => (r -> r' -> r) -> r -> (a -> r') -> a -> r
gmapQl combine zero op = foldl combine zero . map op . children
gmapQr :: Uniplate a => (r' -> r -> r) -> r -> (a -> r') -> a -> r
gmapQr combine zero op = foldr combine zero . map op . children
gmapQ :: Uniplate a => (a -> u) -> a -> [u]
gmapQ f = map f . children
gmapQi :: Uniplate a => Int -> (a -> u) -> a -> u
gmapQi i f x = gmapQ f x !! i
gmapM :: (Uniplate a, Monad m) => (a -> m a) -> a -> m a
gmapM = descendM
mkT :: (a -> a) -> (a -> a)
mkT = id
everywhere :: Biplate b a => (a -> a) -> b -> b
everywhere = transformBi
mkM :: Monad m => (a -> m a) -> a -> m a
mkM = id
everywhereM :: (Biplate b a, Monad m) => (a -> m a) -> b -> m b
everywhereM = transformBiM
mkQ :: r -> (a -> r) -> (r, a -> r)
mkQ = (,)
everything :: Biplate b a => (r -> r -> r) -> (r, a -> r) -> b -> r
everything combine (nil, op) = foldl combine nil . map op . universeBi