lens-3.9.0.1: Lenses, Folds and Traversals

Numeric.Lens

Contents

Description

Synopsis

base :: Integral a => Int -> 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.

binary :: Integral a => Prism' String aSource

binary = base 2

binary

base

octal :: Integral a => Prism' String aSource

octal = base 8

octal

decimal :: Integral a => Prism' String aSource

decimal = base 10

decimal

hex :: Integral a => Prism' String aSource

hex = base 16

hex