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.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Moduleoptics-core-0.4.1.1Haskell2010
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 = re (adding n)
multiplying n = iso (*n) (/n)Note: This errors for n = 0
5 & multiplying 1000 %~ (+3)5.003
let fahrenheit = multiplying (9/5) % adding 32 in 230 ^. re fahrenheit110.0
dividing n = iso (/n) (*n)
dividing n = re (multiplying n)Note: This errors for n = 0
exponentiating n = iso (**n) (**recip n)Note: This errors for n = 0
au (coerced1 @Sum % re (exponentiating 2)) (foldMapOf each) (3,4) == 5True