lens-3.8.4: Lenses, Folds and Traversals

Numeric.Lens

Description

Synopsis

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

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

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

>>>

"100" ^? base 16

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

1767707668033969 ^. re (base 36)

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

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

Prism

Integral

Integer

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