Fri Jun 1 08:37:51 EDT 2018
Monadic processing of a tree
- Either wrap the monad and work with (>>=)
- Use IterM
The former is more direct. The latter uses f (m a) -> m a at each
instance of the functor, to reduce the functor to a single value. The
values are wrapped in a monad to allow threading the side effect
through the iteration.
I'm surpristed though there is no f (m a) -> m (), to be able to run
the iteration for side-effect only.
It's not easy to build one unless the monad is wrapped in maybe.
Actually it makes no sense: the input at each level must be the output
from another level.
What I'm trying to do is to create a "path builder" into a nested
s-expression, where the "directory name" used for stringing the path
together is just a node. In general, this might not work.
What is a "pathable tree"?
Actually keyed doesn't pick out an element. It's an f->f map.
But it can probably used as some building block.