A prism that shows and reads integers in base-2 through base-36
Note: This is an improper prism, since leading 0s are stripped when reading.
"100" ^? base 16Just 256
1767707668033969 ^. re (base 36)"helloworld"
:: a typeCtrl KGHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11
Modulelens-5.3.6Haskell2010
A prism that shows and reads integers in base-2 through base-36
Note: This is an improper prism, since leading 0s are stripped when reading.
"100" ^? base 16Just 256
1767707668033969 ^. re (base 36)"helloworld"
subtracting n = iso (subtract n) ((+n)
subtracting n = from (adding n)
multiplying n = iso (*n) (/n)Note: This errors for n = 0
5 & multiplying 1000 +~ 35.003
let fahrenheit = multiplying (9/5).adding 32 in 230^.from fahrenheit110.0
dividing n = iso (/n) (*n)
dividing n = from (multiplying n)Note: This errors for n = 0
exponentiating n = iso (**n) (**recip n)Note: This errors for n = 0
au (_Wrapping Sum . from (exponentiating 2)) (foldMapOf each) (3,4) == 5True