New methods for Data.Sequence
Data.Sequence is meant as a general-purpose implementation of finite sequences. The range of methods it offers, however, is considerably more constrained than Data.List, even allowing for the constraint that sequences are finite.
The following methods cannot be efficiently implemented based on currently exported methods from Data.Sequence.
-
zipWithand its variants. Note: it suffices to definezipWithalone. -
replicate. (This can be implemented inO(log n)time with node sharing.)
The following methods are relatively simple extensions of already-exported methods. It may be more appropriate to allow library users to reimplement them themselves.
-
scanl,scanr, and variants. This is relatively straightforward using methods borrowed from theTraversableinstance. -
tailsandinits.tailsis equivalent toscanr (<|) empty;initsis similar. -
takeWhile,dropWhile,span,break(and perhaps from-the-end variations). Finding a breakpoint index can be done as efficiently on lists as on sequences; find the appropriate breakpoint index after converting to a list and usesplitAt. -
unfoldranditerate, though the latter would require a finite number of iterations to perform. -
partition. I can conceive of a slightly more efficient implementation than the trivial one, but the gains may be minimal.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.10.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |