-
Notifications
You must be signed in to change notification settings - Fork 15
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
Restore tail :: DList a -> DList a
?
#98
Comments
When tail :: DList a -> [a]
tail xs = case toList xs of
_ : ys -> ys
[] -> error "Data.DList.tail: empty DList" Do you have an actual need for |
No, I just noted the API change and wondered why it was necessary. Maybe I found that errors like |
In general, I agree with everything you said. But I think the error here is slightly better than the error you'd get from Thanks for the feedback. Always appreciated! |
Actually, I was wrong. Indeed, package |
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
Let me allow another stab at this issue. I would also be grateful if you kept the issue open so that it is more visible to the community, and others can join the discussion. I am deeply convicted that
I understand that it is inconvenient to row back on the change of |
From my perspective, if |
@Bodigrim: |
In 1.0, the function
tail
changed toDList a -> [a]
, motivated by the removal of the recursorlist
.However, what speaks against the following definition?
This would be a proper efficient
tail
function forDList
.The new
tail
(dlist-1.0) leaves the realm ofDList
s, so it seems it is already subsumed byData.List.tail . toList
.Originally posted by @andreasabel in #69 (comment)
The text was updated successfully, but these errors were encountered: