-
Notifications
You must be signed in to change notification settings - Fork 6
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
tail
in the DList
instance is not efficient
#14
Comments
A couple of things:
|
@spl wrote:
I don't think this is an option here because the constructor for |
It's exported from |
@spl: I tried
That's to be expected when looking at the docs at https://hackage.haskell.org/package/dlist-1.0:
(That's also the convention: |
@andreasabel Sorry, I misremembered. Use |
@andreasabel Also, there's documentation on this under the heading of Abstraction at the link you provided: https://hackage.haskell.org/package/dlist-1.0. |
Thanks for the guidance. I'll use this backdoor, then.
Thanks, I see this. (Actually, I do not want to do anything unsafe, the There is still a problem with accessing the documentation of |
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
Fix #14: efficient tail instance for difference list
tail :: DList a -> DList a
is essentiallyDList.fromList . Data.List.tail . DList.toList
in dlist-1.0, which is losing efficiency over(Data.List.tail .)
. The latter cannot be implemented outside ofdlist
though, due to data abstraction.See 8c20780#r55694269 and spl/dlist#98.
The text was updated successfully, but these errors were encountered: