>> * further simplify Darcs.UI.Commands.Util.Tree
>
>> Use of the TreeMonad here is overkill and can be avoided by adding a simple
>> monadic variant of Darcs.Util.Tree.find expands Stubs on the way. Also
>> export isSub from Darcs.Util.Tree for convenience.
>
> OK, though it's not obvious to me that adding new code is an improvement
> unless the end goal is to get rid of TM.exists etc.
The goal was to get rid of Darcs.UI.Commands.Util.Tree as realized in
* move stuff from Darcs.UI.Commands.Util.Tree to Darcs.Util.Tree
The exist* functions in TreeMonad are needed elsewhere e.g. in the
instance ApplyMonad.
In general, an imperative IO-like API such as TreeMonad should (IMHO) be
avoided when better alternatives, such as directly operating on Trees in
a functional style, are suitable. The only excuse for TreeMonad is that
it provides us with an efficient ApplyMonad instance. In particular, the
TreeMonad mechanism allows us to apply long chains of patches in
constant memory. (Although, now that I think about it, shouldn't it be
possible to achieve the same with a pure apply?)
|