lens-4.4.0.2: Lenses, Folds and Traversals

Copyright(C) 2012-14 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell98

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.