text-show-3.10.4: Efficient conversion of values into Text

Copyright | (C) 2014-2017 Ryan Scott
License | BSD-style (see the file LICENSE)
Maintainer | Ryan Scott
Stability | Provisional
Portability | GHC
Safe Haskell | Safe-Inferred
Language | Haskell2010

TextShow.Data.Floating

Contents

- Orphan instances

Description

`TextShow` instances and monomorphic functions for floating-point types.

Since: 2

Synopsis

- showbRealFloatPrec :: RealFloat a => Int -> a -> Builder
- showbEFloat :: RealFloat a => Maybe Int -> a -> Builder
- showbFFloat :: RealFloat a => Maybe Int -> a -> Builder
- showbGFloat :: RealFloat a => Maybe Int -> a -> Builder
- showbFFloatAlt :: RealFloat a => Maybe Int -> a -> Builder
- showbGFloatAlt :: RealFloat a => Maybe Int -> a -> Builder
- showbFPFormat :: FPFormat -> Builder
- data FPFormat
  - = Exponent
  - | Fixed
  - | Generic
- formatRealFloatB :: RealFloat a => FPFormat -> Maybe Int -> a -> Builder
- formatRealFloatAltB :: RealFloat a => FPFormat -> Maybe Int -> Bool -> a -> Builder

# Documentation

showbRealFloatPrec :: RealFloat a => Int -> a -> Builder Source #

Convert a `RealFloat` value to a `Builder` with the given precedence.

Since: 2

showbEFloat :: RealFloat a => Maybe Int -> a -> Builder Source #

Show a signed `RealFloat` value using scientific (exponential) notation (e.g. `2.45e2`, `1.5e-3`).

In the call ``showbEFloat` digs val`, if `digs` is `Nothing`, the value is shown to full precision; if `digs` is ``Just` d`, then at most `d` digits after the decimal point are shown.

Since: 2

showbFFloat :: RealFloat a => Maybe Int -> a -> Builder Source #

Show a signed `RealFloat` value using standard decimal notation (e.g. `245000`, `0.0015`).

In the call ``showbFFloat` digs val`, if `digs` is `Nothing`, the value is shown to full precision; if `digs` is ``Just` d`, then at most `d` digits after the decimal point are shown.

Since: 2

showbGFloat :: RealFloat a => Maybe Int -> a -> Builder Source #

Show a signed `RealFloat` value using standard decimal notation for arguments whose absolute value lies between `0.1` and `9,999,999`, and scientific notation otherwise.

In the call ``showbGFloat` digs val`, if `digs` is `Nothing`, the value is shown to full precision; if `digs` is ``Just` d`, then at most `d` digits after the decimal point are shown.

Since: 2

showbFFloatAlt :: RealFloat a => Maybe Int -> a -> Builder Source #

Show a signed `RealFloat` value using standard decimal notation (e.g. `245000`, `0.0015`).

This behaves as `showFFloat`, except that a decimal point is always guaranteed, even if not needed.

Since: 2

showbGFloatAlt :: RealFloat a => Maybe Int -> a -> Builder Source #

Show a signed `RealFloat` value using standard decimal notation for arguments whose absolute value lies between `0.1` and `9,999,999`, and scientific notation otherwise.

This behaves as `showFFloat`, except that a decimal point is always guaranteed, even if not needed.

Since: 2

showbFPFormat :: FPFormat -> Builder Source #

Convert an `FPFormat` value to a `Builder`.

Since: 2

data FPFormat Source #

Control the rendering of floating point numbers.

Constructors

Exponent | Scientific notation (e.g. `2.3e123`).
Fixed | Standard decimal notation.
Generic | Use decimal notation for values between `0.1` and `9,999,999`, and scientific notation otherwise.

#### Instances

Instances details

Bounded FPFormat |
Instance details Defined in Data.Text.Lazy.Builder.RealFloat Methods minBound :: FPFormat Source # maxBound :: FPFormat Source #
Enum FPFormat |

Instance details

Defined in Data.Text.Lazy.Builder.RealFloat

Methods

succ :: FPFormat -> FPFormat Source #

pred :: FPFormat -> FPFormat Source #

toEnum :: Int -> FPFormat Source #

fromEnum :: FPFormat -> Int Source #

enumFrom :: FPFormat -> [FPFormat] Source #

enumFromThen :: FPFormat -> FPFormat -> [FPFormat] Source #

enumFromTo :: FPFormat -> FPFormat -> [FPFormat] Source #

enumFromThenTo :: FPFormat -> FPFormat -> FPFormat -> [FPFormat] Source #

Read FPFormat |
Instance details Defined in Data.Text.Lazy.Builder.RealFloat Methods readsPrec :: Int -> ReadS FPFormat Source # readList :: ReadS [FPFormat] Source # readPrec :: ReadPrec FPFormat Source # readListPrec :: ReadPrec [FPFormat] Source #
Show FPFormat |
Instance details Defined in Data.Text.Lazy.Builder.RealFloat Methods showsPrec :: Int -> FPFormat -> ShowS Source # show :: FPFormat -> String Source # showList :: [FPFormat] -> ShowS Source #
TextShow FPFormat Source # | Since: 2

Instance details

Defined in TextShow.Data.Floating

Methods

showbPrec :: Int -> FPFormat -> Builder Source #

showb :: FPFormat -> Builder Source #

showbList :: [FPFormat] -> Builder Source #

showtPrec :: Int -> FPFormat -> Text Source #

showt :: FPFormat -> Text Source #

showtList :: [FPFormat] -> Text Source #

showtlPrec :: Int -> FPFormat -> Text Source #

showtl :: FPFormat -> Text Source #

showtlList :: [FPFormat] -> Text Source #

formatRealFloatB Source #

Arguments

:: RealFloat a |
=> FPFormat | What notation to use.
-> Maybe Int | Number of decimal places to render.
-> a |
-> Builder |

Like `formatRealFloatAltB`, except that the decimal is only shown for arguments whose absolute value is between `0.1` and `9,999,999`.

Since: 2

formatRealFloatAltB Source #

Arguments

:: RealFloat a |
=> FPFormat | What notation to use.
-> Maybe Int | Number of decimal places to render.
-> Bool | Should a decimal point always be shown?
-> a |
-> Builder |

Converts a `RealFloat` value to a Builder, specifying if a decimal point should always be shown.

Since: 2

# Orphan instances

TextShow FPFormat Source # | Since: 2

Instance details

Methods

showbPrec :: Int -> FPFormat -> Builder Source #

showb :: FPFormat -> Builder Source #

showbList :: [FPFormat] -> Builder Source #

showtPrec :: Int -> FPFormat -> Text Source #

showt :: FPFormat -> Text Source #

showtList :: [FPFormat] -> Text Source #

showtlPrec :: Int -> FPFormat -> Text Source #

showtl :: FPFormat -> Text Source #

showtlList :: [FPFormat] -> Text Source #

TextShow Double Source # | Since: 2
Instance details Methods showbPrec :: Int -> Double -> Builder Source # showb :: Double -> Builder Source # showbList :: [Double] -> Builder Source # showtPrec :: Int -> Double -> Text Source # showt :: Double -> Text Source # showtList :: [Double] -> Text Source # showtlPrec :: Int -> Double -> Text Source # showtl :: Double -> Text Source # showtlList :: [Double] -> Text Source #
TextShow Float Source # | Since: 2
Instance details Methods showbPrec :: Int -> Float -> Builder Source # showb :: Float -> Builder Source # showbList :: [Float] -> Builder Source # showtPrec :: Int -> Float -> Text Source # showt :: Float -> Text Source # showtList :: [Float] -> Text Source # showtlPrec :: Int -> Float -> Text Source # showtl :: Float -> Text Source # showtlList :: [Float] -> Text Source #