module Data.Generics.Compos where
import Control.Monad
import Data.Generics.Uniplate.Operations
class Uniplate a => Compos a where
composOp :: Uniplate a => (a -> a) -> a -> a
composOp :: (a -> a) -> a -> a
composOp = (a -> a) -> a -> a
forall on. Uniplate on => (on -> on) -> on -> on
descend
composOpM :: (Uniplate a, Applicative m) => (a -> m a) -> a -> m a
composOpM :: (a -> m a) -> a -> m a
composOpM = (a -> m a) -> a -> m a
forall on (m :: * -> *).
(Uniplate on, Applicative m) =>
(on -> m on) -> on -> m on
descendM
composOpM_ :: (Uniplate a, Monad m) => (a -> m ()) -> a -> m ()
composOpM_ :: (a -> m ()) -> a -> m ()
composOpM_ = m () -> (m () -> m () -> m ()) -> (a -> m ()) -> a -> m ()
forall a b. Uniplate a => b -> (b -> b -> b) -> (a -> b) -> a -> b
composOpFold (() -> m ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()) m () -> m () -> m ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
(>>)
composOpMonoid :: (Uniplate a, Monoid m) => (a -> m) -> a -> m
composOpMonoid :: (a -> m) -> a -> m
composOpMonoid = m -> (m -> m -> m) -> (a -> m) -> a -> m
forall a b. Uniplate a => b -> (b -> b -> b) -> (a -> b) -> a -> b
composOpFold m
forall a. Monoid a => a
mempty m -> m -> m
forall a. Monoid a => a -> a -> a
mappend
composOpMPlus :: (Uniplate a, MonadPlus m) => (a -> m b) -> a -> m b
composOpMPlus :: (a -> m b) -> a -> m b
composOpMPlus = m b -> (m b -> m b -> m b) -> (a -> m b) -> a -> m b
forall a b. Uniplate a => b -> (b -> b -> b) -> (a -> b) -> a -> b
composOpFold m b
forall (m :: * -> *) a. MonadPlus m => m a
mzero m b -> m b -> m b
forall (m :: * -> *) a. MonadPlus m => m a -> m a -> m a
mplus
composOpFold :: Uniplate a => b -> (b -> b -> b) -> (a -> b) -> a -> b
composOpFold :: b -> (b -> b -> b) -> (a -> b) -> a -> b
composOpFold b
zero b -> b -> b
combine a -> b
f = (b -> b -> b) -> b -> [b] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr b -> b -> b
combine b
zero ([b] -> b) -> (a -> [b]) -> a -> b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> b) -> [a] -> [b]
forall a b. (a -> b) -> [a] -> [b]
map a -> b
f ([a] -> [b]) -> (a -> [a]) -> a -> [b]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> [a]
forall on. Uniplate on => on -> [on]
children