lens-3.8.7.3: Lenses, Folds and Traversals

Portability | portable
Stability | provisional
Maintainer | Edward Kmett <ekmett@gmail.com>
Safe Haskell | None

Data.List.Lens

Contents

- Deprecated

Description

Traversals for manipulating parts of a list.

Synopsis

- prefixed :: Eq a => [a] -> Prism' [a] [a]
- suffixed :: Eq a => [a] -> Prism' [a] [a]
- stripSuffix :: Eq a => [a] -> [a] -> Maybe [a]
- strippingPrefix :: Eq a => [a] -> Prism' [a] [a]
- strippingSuffix :: Eq a => [a] -> Prism' [a] [a]

# Documentation

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

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]

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

    >>> "review" ^? suffixed "view"
    Just "re"

    >>> "review" ^? suffixed "tire"
    Nothing

    >>> suffixed ".o" # "hello"
    "hello.o"

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

# Deprecated

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

Deprecated: Use 'prefixed'.

This is a deprecated alias for `prefixed`.

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

Deprecated: Use 'suffixed'.

This is a deprecated alias for `suffixed`.