Proposal: improve the Data.Tree API

Sean Leather sean.leather at gmail.com
Thu Feb 27 14:53:01 UTC 2014


On Thu, Feb 27, 2014 at 3:08 PM, Johan Tibell wrote:

> General comment: none of the other containers APIs use a
> function<DataType> suffix. I noticed that Data.Tree does for a bunch of
> functions.
>

Isn't that because there are Tree and Forest variants of functions with
different types? For example:

unfoldTree :: (b -> (a, [b])) -> b -> Tree a
unfoldForest :: (b -> (a, [b])) -> [b] -> Forest a

The other container APIs do not have mutually recursive type names like
Tree and Forest and, therefore, do not have analogous function variants.

 Perhaps we should avoid continuing down that path and instead have
> functions like 'lookup' and 'lookupInForest'.
>

To be consistent with the Data.Tree naming pattern of Tree/Forest variants,
maybe these functions should be lookupTree/lookupForest or
lookupInTree/lookupInForest. Otherwise, your conclusion may be valid for
functions that are do not have variants.

Regards,
Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140227/3fe2a446/attachment.html>


More information about the Libraries mailing list