HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulefmt-0.6.3.0Haskell2010

Fmt.Internal.Numeric

  • 12 values
  • Packagefmt-0.6.3.0
  • Exports12
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceNumeric.hs
Example1 expression
import Fmt
valueoctF :: Integral a => a -> Builder
#

Format a number as octal:

Example1 expression
listF' octF [7,8,9,10]"[7, 10, 11, 12]"
valuebinF :: Integral a => a -> Builder
#

Format a number as binary:

Example1 expression
listF' binF [7,8,9,10]"[111, 1000, 1001, 1010]"
valuebaseF :: (HasCallStack, Integral a) => Int -> a -> Builder
#

Format a number in arbitrary base (up to 36):

Example3 expressions
baseF 3 10000"111201101"baseF 7 10000"41104"baseF 36 10000"7ps"
valuefloatF :: Real a => a -> Builder
#

Format a floating-point number:

Example1 expression
floatF 3.1415"3.1415"

Numbers smaller than 1e-6 or bigger-or-equal to 1e21 will be displayed using scientific notation:

Example3 expressions
listF' floatF [-1.2,-12.2]"[-1.2, -12.2]"listF' floatF [1e-6,9e-7]"[0.000001, 9.0e-7]"listF' floatF [9e20,1e21]"[900000000000000000000.0, 1.0e21]"
valueexptF :: Real a => Int -> a -> Builder
#

Format a floating-point number using scientific notation, with the given amount of decimal places.

Example1 expression
listF' (exptF 5) [pi,0.1,10]"[3.14159e0, 1.00000e-1, 1.00000e1]"
valuefixedF :: Real a => Int -> a -> Builder
#

Format a floating-point number without scientific notation:

Example1 expression
listF' (fixedF 5) [pi,0.1,10]"[3.14159, 0.10000, 10.00000]"