lens-3.10: 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]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 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]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`.