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

Fix #14: efficient tail instance for difference list #15

Merged
merged 1 commit into from
Sep 1, 2021
Merged

Conversation

andreasabel
Copy link
Collaborator

Fix #14: efficient tail instance for difference list.

PR #5 offered a workaround for the regression in dlist-1.0 which changed the type of the tail function for difference lists (so it does not have the type DList a -> DList a of a tail function anymore).

The problem with #5 is that it collapses the difference list to compute its tail.

Here, we offer a solution that does not collapse the difference list, by precomposing the Data.List.tail with the underlying function [a] -> [a] of a difference list. Data.List.Unsafe gives us access to this function.

This problem would better be fixed upstream, see spl/dlist#98.

PR #5 offered a workaround for the regression in `dlist-1.0` which
changed the type of the `tail` function for difference lists (so it does
not have the type `DList a -> DList a` of a tail function anymore).

The problem with #5 is that it collapses the difference list to
compute its tail.

Here, we offer a solution that does not collapse the difference list,
by precomposing the `Data.List.tail` with the underlying function
`[a] -> [a]` of a difference list.   Data.List.Unsafe gives us access
to this function.

This problem would better be fixed upstream, see
spl/dlist#98
@andreasabel andreasabel added the performance Efficiency/performance issue. label Sep 1, 2021
@andreasabel andreasabel added this to the 4.7.5 milestone Sep 1, 2021
@andreasabel andreasabel self-assigned this Sep 1, 2021
@ddssff
Copy link
Owner

ddssff commented Sep 1, 2021

This looks trustworthy to me.

@ddssff ddssff merged commit 3779710 into master Sep 1, 2021
@ddssff
Copy link
Owner

ddssff commented Sep 1, 2021

Am I still the maintainer of listlike? Maybe I should step down. I'm just merging pull requests reflexively.

@andreasabel
Copy link
Collaborator Author

Am I still the maintainer of listlike? Maybe I should step down. I'm just merging pull requests reflexively.

You already made me co-maintainer, giving me all the powers needed (write access and release permissions). If you want, I can also take over officially as "main-maintainer".

In general, I think it is good to have several maintainers, as sometimes one becomes unresponsive, and then there are others to step up...

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

Successfully merging this pull request may close these issues.

tail in the DList instance is not efficient
2 participants