The Seq type
Contents
- Building Seqs
- Seq is Foldable
- Focusing on the ends
- Pattern synonyms
- The other end
- Working with indices
We get a lot of mileage out of the linked list type []
and its related functions in Data.List
Data.List
, but there is a whole world of other list-like types out there. The first you should learn about is Seq
, because its wide assortment of reasonably efficient operations makes it the most generally useful list type.We will not go into the details of how the Seq
data structure is implemented; see Finger Trees (2006) if you are interested in the math.
The Seq
type may be found in the Data.Sequence
Data.Sequence
module of the containers
package. We will use the following imports: