Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data.Tree additional functions #39

Open
jcristovao opened this issue Feb 21, 2014 · 5 comments
Open

Data.Tree additional functions #39

jcristovao opened this issue Feb 21, 2014 · 5 comments

Comments

@jcristovao
Copy link

Hi,
The provided tree api seems a little small. After doing the usual workflow of defining my own version of, for example, subtreeat :: Eq a => a -> Tree a -> Maybe (Tree a), only to later find it defined somewhere at hackage, my question is:

Does it make sense to include some of the functions defined in:
http://hackage.haskell.org/package/debian-3.81/docs/Debian-Apt-Dependencies.html#g:3
and
http://hackage.haskell.org/package/hledger-lib-0.22.1/docs/Hledger-Utils.html#v:subtreeat
As functions of Data.Tree, or should that be left for a separate package?

My imediate suggestions would be:
treefilter :: (a -> Bool) -> Tree a -> Tree a
subtreeat :: Eq a => a -> Tree a -> Maybe (Tree a)
subtreeinforest :: Eq a => a -> [Tree a] -> Maybe (Tree a)

Or am I missing some easier way of avoiding these functions?

@foxik
Copy link
Contributor

foxik commented Feb 22, 2014

The Tree API is really very poor. The reason is only that nobody has spend time working on it.

It makes sense to add functions to the Treemodule. The naming should be consistent with the rest of the containers API, so treefilter should really be just filter, the subtreeat maybe lookupTree, etc.

Please note that containers API changes are subject to http://www.haskell.org/haskellwiki/Library_submissions process, especially see http://www.haskell.org/haskellwiki/Library_submissions#Guidance_for_proposers. If you want to pursue this, please send a specific proposal (functions and their types you want to add; no implementation is needed at this point) to the libraries mailing list.

Cheers,
Milan

@jcristovao
Copy link
Author

Allright, I'll see if I can find some time to make the proposals, thanks!
Cheers,
João

@jcristovao
Copy link
Author

Hi again,
I'm sorry for the delay on this...
So, the discussion threads:
1
2
Should I send a new email with a summary, just to make sure that everyone is on-board with the latest proposal (your, of separating the Tree from the Forest functions), or the current discussion is sufficient to advance with this?
Cheers,
João

@foxik
Copy link
Contributor

foxik commented Jun 17, 2014

Please reiterate it on libraries list. Just start a new thread with the latest proposal.

I am not saying the Tree/Forest module split is the best alternative, it was just an idea. Please do not hesitate to mention in the proposal also the possibility of distinguishing functions using names only (i.e., using empty vs. Forest suffix (like filter + filterForest), or forest prefix (filter and forestFilter, or anything you come up with).

@m-renaud
Copy link
Contributor

m-renaud commented Dec 25, 2017

It's been quite some time since this has been updated, was there any resolution on the libraries list for these? If not I was planning on going through the Tree api and putting together a proposal for functions to be added, I can include these in the list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants