lens-3.8.7.3: Lenses, Folds and Traversals

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

Numeric.Lens

Description

Synopsis

- base :: Integral a => a -> Prism' String a
- integral :: (Integral a, Integral b) => Prism Integer Integer a b

# Documentation

base :: Integral a => a -> Prism' String a

A prism that shows and reads integers in base-2 through base-36

    >>> "100" ^? base 16
    Just 256

    >>> 1767707668033969 ^. re (base 36)
    "helloworld"

integral :: (Integral a, Integral b) => Prism Integer Integer a b

This `Prism` extracts can be used to model the fact that every `Integral` type is a subset of `Integer`.

Embedding through the `Prism` only succeeds if the `Integer` would pass through unmodified when re-extracted.