happstack-data-6.0.0: Happstack data manipulation libraries

Happstack.Data.GOps

Synopsis

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.

gAsk :: (Data r, Typeable a, MonadReader r m, MonadPlus n) => (a -> n b) -> m (n b)Source

A generalized ask that will traverse the stored type of the MonadReader in an attempt to find an a and will then apply the provided function if found.

gGet :: (Data s, Typeable a, MonadState s m, MonadPlus n) => (a -> n b) -> c -> m (n b)Source

The equivalent of gAsk for MonadState