Proposal: improve the Data.Tree API

João Cristóvão jmacristovao at
Fri Feb 28 12:10:51 UTC 2014

I'm with Sean here,

In Data.Map, for example, the lookup function returns the type Maybe a, not
Data.Map k a.
And find, in Data.Foldable (for which Tree has an instance) also returns a
Maybe a.

But the lookupTree/findTree/lookupTreeInForest functions return Maybe (Tree
a), thus I added the final 'Tree' in the name.

The only function name where that did not apply was filter, since (for
example) for lists the filter function also returns the type of the
original container, not the inner type.

This was the rationale I followed. I'm afraid that renaming findTree to
findBy will be confusing, as it seems that you just provide a 'evaluator
function', but still return the inner type a (like find), instead of the
(actual) Tree a.


2014-02-27 15:27 GMT+00:00 Daniel Trstenjak <daniel.trstenjak at>:

> On Thu, Feb 27, 2014 at 03:05:00PM +0100, Henning Thielemann wrote:
> > Yes please, but I already got lots of resistance for a qualifiable
> > name in Data.Bits.
> I really think that 'Data.Bits' is a bit special in this regard with
> all of its functions, which are often used with back ticks and
> importing all of them explicitely is really a bit annoying.
> Otherwise I'm with you :).
> Greetings,
> Daniel
> _______________________________________________
> Libraries mailing list
> Libraries at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list