- gSet :: (Data b, Typeable a) => a -> b -> b
- gReplace :: (Typeable a, Data b) => (a -> a) -> b -> b
- gFind :: (MonadPlus m, Data a, Typeable b) => a -> m b
- gFind' :: (Data a, Typeable b) => a -> b
- gModify :: (MonadState s m, Typeable a, Data s) => (a -> a) -> m ()
- gAsk :: (Data r, Typeable a, MonadReader r m, MonadPlus n) => (a -> n b) -> m (n b)
- gGet :: (Data s, Typeable a, MonadState s m, MonadPlus n) => (a -> n b) -> c -> m (n b)
Documentation
gSet :: (Data b, Typeable a) => a -> b -> bSource
gSet x y
will traveral x
and replace
any instances of the type a
in its structure
with y
.
gReplace :: (Typeable a, Data b) => (a -> a) -> b -> bSource
gReplace f b
will traverse x
and will act on
any instance of the type a
in its structure with
the function f
.
gFind :: (MonadPlus m, Data a, Typeable b) => a -> m bSource
gFind a
will extract any elements of type b
from
a
's structure in accordance with the MonadPlus
instance, e.g. Maybe Foo will return the first Foo
found while [Foo] will return the list of Foos found.
gFind' :: (Data a, Typeable b) => a -> bSource
Acts as gFind but will throw an exception if nothing is found.
gModify :: (MonadState s m, Typeable a, Data s) => (a -> a) -> m ()Source
A generalized modify that will apply the modification function to the structure of the state.