
20 Mar
2007
20 Mar
'07
11:34 a.m.
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