lens-4.1.2: Lenses, Folds and Traversals

Portabilityportable
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellNone

Data.List.Lens

Contents

Description

Traversals for manipulating parts of a list.

Synopsis

Documentation

prefixed :: Eq a => [a] -> Prism' [a] [a]Source

A Prism stripping a prefix from a list when used as a Traversal, or prepending that prefix when run backwards:

>>> "preview" ^? prefixed "pre"
Just "view"
>>> "review" ^? prefixed "pre"
Nothing
>>> prefixed "pre" # "amble"
"preamble"

suffixed :: Eq a => [a] -> Prism' [a] [a]Source

A Prism stripping a suffix from a list when used as a Traversal, or appending that suffix when run backwards:

>>> "review" ^? suffixed "view"
Just "re"
>>> "review" ^? suffixed "tire"
Nothing
>>> suffixed ".o" # "hello"
"hello.o"

stripSuffix :: Eq a => [a] -> [a] -> Maybe [a]Source

Deprecated

strippingPrefix :: Eq a => [a] -> Prism' [a] [a]Source

Deprecated: Use prefixed.

This is a deprecated alias for prefixed.

strippingSuffix :: Eq a => [a] -> Prism' [a] [a]Source

Deprecated: Use suffixed.

This is a deprecated alias for suffixed.