-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Edge of developments for "text-builder"
--   
--   This is a development version of "text-builder". All
--   experimentation and feature development happens here. The API can
--   change drastically. For a more stable API use "text-builder".
--   
--   The packages are compatible, because they both operate on the type
--   defined in "text-builder-core".
@package text-builder-dev
@version 0.4

module TextBuilderDev

-- | Composable specification of how to efficiently construct strict
--   Text.
--   
--   Provides instances of Semigroup and Monoid, which have
--   complexity of O(1).
data TextBuilder

-- | Execute the builder producing a strict text.
toText :: TextBuilder -> Text

-- | Convert builder to string.
toString :: TextBuilder -> String

-- | Check whether the builder is empty.
isEmpty :: TextBuilder -> Bool

-- | Run the builder and pack the produced text into a new builder.
--   
--   Useful to have around builders that you reuse, because a forced
--   builder is much faster, since it's virtually a single call to
--   memcopy.
force :: TextBuilder -> TextBuilder

-- | Intercalate builders.
--   
--   
--   >>> intercalate ", " ["a", "b", "c"]
--   "a, b, c"
--   
--   
--   
--   >>> intercalate ", " ["a"]
--   "a"
--   
--   
--   
--   >>> intercalate ", " []
--   ""
--   
intercalate :: Foldable f => TextBuilder -> f TextBuilder -> TextBuilder

-- | Intercalate projecting values to builder.
intercalateMap :: Foldable f => TextBuilder -> (a -> TextBuilder) -> f a -> TextBuilder

-- | Pad a builder from the left side to the specified length with the
--   specified character.
--   
--   
--   >>> padFromLeft 5 '0' "123"
--   "00123"
--   
--   
--   
--   >>> padFromLeft 5 '0' "123456"
--   "123456"
--   
padFromLeft :: Int -> Char -> TextBuilder -> TextBuilder

-- | Pad a builder from the right side to the specified length with the
--   specified character.
--   
--   
--   >>> padFromRight 5 ' ' "123"
--   "123  "
--   
--   
--   
--   >>> padFromRight 5 ' ' "123456"
--   "123456"
--   
padFromRight :: Int -> Char -> TextBuilder -> TextBuilder

-- | Strict text.
text :: Text -> TextBuilder

-- | Lazy text.
lazyText :: Text -> TextBuilder

-- | Construct from a list of characters.
string :: String -> TextBuilder

-- | UTF-8 bytestring. You can use it for converting ASCII values as well.
--   
--   Warning: It's your responsibility to ensure that the bytestring
--   is properly encoded.
--   
--   
--   >>> unsafeUtf8ByteString "abc"
--   "abc"
--   
--   
--   
--   >>> import Data.Text.Encoding (encodeUtf8)
--   
--   >>> unsafeUtf8ByteString (encodeUtf8 "фывапролдж") == "фывапролдж"
--   True
--   
unsafeUtf8ByteString :: ByteString -> TextBuilder

-- | Unicode character.
char :: Char -> TextBuilder

-- | Safe Unicode codepoint with invalid values replaced by the �
--   char (codepoint 0xfffd), which is the same as what
--   Data.Text.pack does.
unicodeCodepoint :: Int -> TextBuilder

-- | Hexadecimal readable representation of binary data.
--   
--   
--   >>> byteStringHexEncoding "Hello"
--   "4865 6c6c 6f"
--   
byteStringHexEncoding :: ByteString -> TextBuilder

-- | Signed decimal representation of an integer.
--   
--   
--   >>> decimal 123456
--   "123456"
--   
--   
--   
--   >>> decimal (-123456)
--   "-123456"
--   
--   
--   
--   >>> decimal 0
--   "0"
--   
--   
--   
--   >>> decimal (-2 :: Int8)
--   "-2"
--   
--   
--   
--   >>> decimal (-128 :: Int8)
--   "-128"
--   
decimal :: Integral a => a -> TextBuilder

-- | Fixed-length decimal without sign. Padded with zeros or trimmed
--   depending on whether it's shorter or longer than specified.
--   
--   
--   >>> fixedLengthDecimal 5 123
--   "00123"
--   
--   
--   
--   >>> fixedLengthDecimal 5 123456
--   "23456"
--   
--   
--   
--   >>> fixedLengthDecimal 5 (-123456)
--   "23456"
--   
--   
--   
--   >>> fixedLengthDecimal 7 (-123456)
--   "0123456"
--   
--   
--   
--   >>> fixedLengthDecimal 0 123
--   ""
--   
--   
--   
--   >>> fixedLengthDecimal (-2) 123
--   ""
--   
fixedLengthDecimal :: Integral a => Int -> a -> TextBuilder

-- | Decimal representation of an integral value with thousands separated
--   by the specified character.
--   
--   
--   >>> thousandSeparatedDecimal ',' 1234567890
--   "1,234,567,890"
--   
--   
--   
--   >>> thousandSeparatedDecimal ' ' (-1234567890)
--   "-1 234 567 890"
--   
thousandSeparatedDecimal :: Integral a => Char -> a -> TextBuilder

-- | Two's complement binary representation of a value.
--   
--   Bits of a statically sized value padded from the left according to the
--   size. If it's a negatable integer, the sign is reflected in the bits.
--   
--   
--   >>> binary @Int8 0
--   "00000000"
--   
--   
--   
--   >>> binary @Int8 4
--   "00000100"
--   
--   
--   
--   >>> binary @Int8 (-1)
--   "11111111"
--   
--   
--   
--   >>> binary @Word8 255
--   "11111111"
--   
--   
--   
--   >>> binary @Int16 4
--   "0000000000000100"
--   
--   
--   
--   >>> binary @Int16 (-4)
--   "1111111111111100"
--   
binary :: FiniteBits a => a -> TextBuilder

-- | Same as binary, but with the "0b" prefix.
--   
--   
--   >>> prefixedBinary @Int8 0
--   "0b00000000"
--   
prefixedBinary :: FiniteBits a => a -> TextBuilder

-- | Octal representation of an integer.
--   
--   
--   >>> octal @Int32 123456
--   "00000361100"
--   
--   
--   
--   >>> octal @Int32 (-123456)
--   "77777416700"
--   
octal :: (FiniteBits a, Integral a) => a -> TextBuilder

-- | Same as octal, but with the "0o" prefix.
--   
--   
--   >>> prefixedOctal @Int8 0
--   "0o000"
--   
prefixedOctal :: (FiniteBits a, Integral a) => a -> TextBuilder

-- | Integer in hexadecimal notation with a fixed number of digits
--   determined by the size of the type.
--   
--   
--   >>> hexadecimal @Int8 0
--   "00"
--   
--   
--   
--   >>> hexadecimal @Int8 4
--   "04"
--   
--   
--   
--   >>> hexadecimal @Int8 (-128)
--   "80"
--   
--   
--   
--   >>> hexadecimal @Int8 (-1)
--   "ff"
--   
--   
--   
--   >>> hexadecimal @Word8 255
--   "ff"
--   
--   
--   
--   >>> hexadecimal @Int32 123456
--   "0001e240"
--   
--   
--   
--   >>> hexadecimal @Int32 (-123456)
--   "fffe1dc0"
--   
hexadecimal :: (FiniteBits a, Integral a) => a -> TextBuilder

-- | Same as hexadecimal, but with the "0x" prefix.
--   
--   
--   >>> prefixedHexadecimal @Int8 0
--   "0x00"
--   
prefixedHexadecimal :: (FiniteBits a, Integral a) => a -> TextBuilder

-- | Double with a fixed number of decimal places.
--   
--   
--   >>> doubleFixedPoint 4 0.123456
--   "0.1235"
--   
--   
--   
--   >>> doubleFixedPoint 2 2.1
--   "2.10"
--   
--   
--   
--   >>> doubleFixedPoint (-2) 2.1
--   "2"
--   
--   
--   
--   >>> doubleFixedPoint 2 (-2.1)
--   "-2.10"
--   
--   
--   
--   >>> doubleFixedPoint 2 0
--   "0.00"
--   
doubleFixedPoint :: Int -> Double -> TextBuilder

-- | Double multiplied by 100 with a fixed number of decimal places applied
--   and followed by a percent-sign.
--   
--   
--   >>> doubleFixedPointPercent 3 0.123456
--   "12.346%"
--   
--   
--   
--   >>> doubleFixedPointPercent 0 2
--   "200%"
--   
--   
--   
--   >>> doubleFixedPointPercent 0 (-2)
--   "-200%"
--   
doubleFixedPointPercent :: Int -> Double -> TextBuilder

-- | UTC time in ISO8601 format.
--   
--   
--   >>> utcTimeIso8601Timestamp (read "2021-11-24 12:11:02 UTC")
--   "2021-11-24T12:11:02Z"
--   
utcTimeIso8601Timestamp :: UTCTime -> TextBuilder

-- | Time interval in seconds. Directly applicable to DiffTime and
--   NominalDiffTime.
--   
--   The format is the following:
--   
--   
--   DD:HH:MM:SS
--   
--   
--   
--   >>> realFracDdHhMmSsInterval @Double 59
--   "00:00:00:59"
--   
--   
--   
--   >>> realFracDdHhMmSsInterval @Double 90
--   "00:00:01:30"
--   
--   
--   
--   >>> realFracDdHhMmSsInterval @Double 86401
--   "01:00:00:01"
--   
--   
--   
--   >>> realFracDdHhMmSsInterval @Double (356 * 86400)
--   "356:00:00:00"
--   
realFracDdHhMmSsInterval :: RealFrac seconds => seconds -> TextBuilder

-- | DiffTime in a compact decimal format based on picoseconds.
diffTimeSeconds :: DiffTime -> TextBuilder

-- | Amount of picoseconds represented in a compact decimal format using
--   suffixes.
--   
--   E.g., the following is 1_230_000_000 picoseconds or 1.23
--   milliseconds or 1230 microseconds:
--   
--   
--   1230us
--   
picoseconds :: Integer -> TextBuilder

-- | Data size in decimal notation over amount of bytes.
--   
--   
--   >>> approximateDataSize 999
--   "999B"
--   
--   
--   
--   >>> approximateDataSize 9999
--   "9.9kB"
--   
--   
--   
--   >>> approximateDataSize (-9999)
--   "-9.9kB"
--   
--   
--   
--   >>> approximateDataSize 1234567890
--   "1.2GB"
--   
--   
--   
--   >>> approximateDataSize 10000000000000000000000000000000023
--   "10,000,000,000YB"
--   
approximateDataSize :: Integral a => a -> TextBuilder

-- | Evidence that there exists an unambiguous way to convert a type to and
--   from TextBuilder.
--   
--   The laws are:
--   
--   
--   
- 
from . to = id

--   
- 
to . from = id

--   
--   
--   This class does not provide implicit rendering, such as from integer
--   to its decimal representation. There are multiple ways of representing
--   an integer as text (e.g., hexadecimal, binary). The non-ambiguity is
--   further enforced by the presence of the inverse conversion. In the
--   integer case there is no way to read it from a textual form without a
--   possibility of failing (e.g., when the input string cannot be parsed
--   as an integer).
class Isomorphic a

-- | Project the type into TextBuilder.
from :: Isomorphic a => a -> TextBuilder

-- | Embed TextBuilder into the type.
to :: Isomorphic a => TextBuilder -> a
