Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

- data Seq a :: * -> *
- (<|) :: a -> Seq a -> Seq a
- (|>) :: Seq a -> a -> Seq a
- adjust :: (a -> a) -> Int -> Seq a -> Seq a
- adjustLast :: (a -> a) -> Seq a -> Seq a
- append :: Seq a -> Seq a -> Seq a
- concat :: Foldable f => f (Seq a) -> Seq a
- concatMap :: Foldable f => (a -> Seq b) -> f a -> Seq b
- dropWhileL :: (a -> Bool) -> Seq a -> Seq a
- dropWhileR :: (a -> Bool) -> Seq a -> Seq a
- empty :: Seq a
- filter :: (a -> Bool) -> Seq a -> Seq a
- fromList :: [a] -> Seq a
- intersperse :: a -> Seq a -> Seq a
- length :: Seq a -> Int
- map :: (a -> b) -> Seq a -> Seq b
- minimum :: Ord a => Seq a -> Maybe a
- maximum :: Ord a => Seq a -> Maybe a
- null :: Seq a -> Bool
- toList :: Seq a -> [a]
- trimWhile :: (a -> Bool) -> Seq a -> Seq a
- singleton :: a -> Seq a

# Documentation

General-purpose finite sequences.

Monad Seq | |

Functor Seq | |

Applicative Seq | |

Foldable Seq | |

Traversable Seq | |

Eq1 Seq | |

Ord1 Seq | |

Read1 Seq | |

Show1 Seq | |

MonadZip Seq | |

Alternative Seq | |

MonadPlus Seq | |

UnzipWith Seq | |

IsList (Seq a) | |

Eq a => Eq (Seq a) | |

Data a => Data (Seq a) | |

Ord a => Ord (Seq a) | |

Read a => Read (Seq a) | |

Show a => Show (Seq a) | |

IsString (Seq Char) | |

Semigroup (Seq a) | |

Monoid (Seq a) | |

NFData a => NFData (Seq a) | |

type Item (Seq a) | |

(<|) :: a -> Seq a -> Seq a infixr 5 #

*O(1)*. Add an element to the left end of a sequence.
Mnemonic: a triangle with the single element at the pointy end.

(|>) :: Seq a -> a -> Seq a infixl 5 #

*O(1)*. Add an element to the right end of a sequence.
Mnemonic: a triangle with the single element at the pointy end.

adjust :: (a -> a) -> Int -> Seq a -> Seq a #

*O(log(min(i,n-i)))*. Update the element at the specified position. If
the position is out of range, the original sequence is returned. `adjust`

can lead to poor performance and even memory leaks, because it does not
force the new value before installing it in the sequence. `adjust'`

should
usually be preferred.

adjustLast :: (a -> a) -> Seq a -> Seq a Source #

`>>>`

fromList [1,2,4]`adjustLast (+ 1) (fromList [1, 2, 3])`

`>>>`

fromList []`adjustLast (+ 1) empty`

dropWhileL :: (a -> Bool) -> Seq a -> Seq a #

*O(i)* where *i* is the prefix length.

returns
the suffix remaining after `dropWhileL`

p xs

.`takeWhileL`

p xs

dropWhileR :: (a -> Bool) -> Seq a -> Seq a #

*O(i)* where *i* is the suffix length.

returns
the prefix remaining after `dropWhileR`

p xs

.`takeWhileR`

p xs

is equivalent to `dropWhileR`

p xs

.`reverse`

(`dropWhileL`

p (`reverse`

xs))

filter :: (a -> Bool) -> Seq a -> Seq a #

*O(n)*. The `filter`

function takes a predicate `p`

and a sequence
`xs`

and returns a sequence of those elements which satisfy the
predicate.

intersperse :: a -> Seq a -> Seq a Source #

Like `intersperse`

, but for `Seq`

.

minimum :: Ord a => Seq a -> Maybe a Source #

`>>>`

Just 1`minimum (fromList [1,2,3])`

`>>>`

Nothing`minimum empty`