Skip to content

Text builder instance writes to wrong offset #56

Description

@goertzenator

Consider the following program:

import Data.Double.Conversion.Convertable
import Data.Text
import qualified Data.Text.Lazy.Builder as TLB

main :: IO ()
main = do
  let
    x1 :: Text = "I have " <> toExponential 2 (3.14 :: Double) <> " cakes."
    x2 :: TLB.Builder = "I have " <> toExponential 2 (3.14 :: Double) <> " cakes."
  putStrLn $ show x1
  putStrLn $ show x2

The output is ...

"I have 3.14e0 cakes."
"3.14e0 \NUL\NUL\NUL\NUL\NUL\NUL cakes."

The Text instance of Convertable produces correct output, but the Builder instance does not. In some other tests I did the Builder output always gets written to the beginning instead of the correct location.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions