haskell / haskell/double-conversion

Text builder instance writes to wrong offset

Open
#56 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
18
Forks
37
PR merge metrics
No merged PRs in 30d

Description

Consider the following program:

``` Haskell
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.