Edsko de Vries wrote:
> Hey,
> 
> I have a structure containing Xs in various places, like so
> 
> data X
> data Structure = Structure .. [X] .. [X] ..
> 
> And I defined mapStructure 
> 
> mapStructure :: (X -> X) -> (Structure -> Structure)
> 
> I then wanted to use mapStructure to define queries as well as
> transformations on structures. I generalized mapStructure to
> mapStructureM:
> 
> mapStructure :: Monad m => (X -> m X) -> (Structure -> m Structure)

I guess you want an applicative functor. See also

http://haskell.org/ghc/docs/latest/html/libraries/base/Data-Traversable.html

and the accompanying papers.

Regards,
apfelmus

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to