add decWord for machine-sized words

This commit is contained in:
Andrew Martin 2019-09-04 14:34:33 -04:00
parent 2e8d4279c7
commit 071b55568d
2 changed files with 14 additions and 0 deletions

View file

@ -32,6 +32,7 @@ module Data.ByteArray.Builder
, word32Dec
, word16Dec
, word8Dec
, wordDec
, int64Dec
, int32Dec
, int16Dec
@ -282,6 +283,12 @@ word16Dec w = fromBounded Nat.constant (Bounded.word16Dec w)
word8Dec :: Word8 -> Builder
word8Dec w = fromBounded Nat.constant (Bounded.word8Dec w)
-- | Encodes an unsigned machine-sized integer as decimal.
-- This encoding never starts with a zero unless the
-- argument was zero.
wordDec :: Word -> Builder
wordDec w = fromBounded Nat.constant (Bounded.wordDec w)
-- | Encode a double-floating-point number, using decimal notation or
-- scientific notation depending on the magnitude. This has undefined
-- behavior when representing @+inf@, @-inf@, and @NaN@. It will not