Skip to content

Data.JSString.pack throws RangeError on lists with certain thunk structures #129

Open
@Dridus

Description

Might be related to #128

I encountered it in the wild by way of showFFloat (Just 6) (2.2e-2), here's a reproduction case

import Numeric (showFFloat)
import Data.JSString (pack, unpack)

main :: IO ()
main = do
  putStrLn . unpack . pack $ showFFloat (Just 2) 2.2e-2 ""

ghcjs ./test.hs && node test.jsexe/all.js results in:

Haskell main thread: RangeError: Invalid code point: NaN
RangeError: Invalid code point: NaN
    at /home/ross/3rd/reflex-platform/test.jsexe/all.js:20550:29
    at h$jsstringPack (/home/ross/3rd/reflex-platform/test.jsexe/all.js:20711:36)
    at h$$Kt (/home/ross/3rd/reflex-platform/test.jsexe/all.js:57018:11)
    at h$runThreadSlice (/home/ross/3rd/reflex-platform/test.jsexe/all.js:6845:11)
    at h$runThreadSliceCatch (/home/ross/3rd/reflex-platform/test.jsexe/all.js:6814:12)
    at Immediate.h$mainLoop [as _onImmediate] (/home/ross/3rd/reflex-platform/test.jsexe/all.js:6809:9)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)

via node and something similar via Safari.

this is using GHCJS 8.6.0.1 (GHC 8.6.5), as packaged with reflex-platform 58873162d542c14cf198e9711986c046b06a18da

when compiled via GHC with Data.Text (pack, unpack), instead the output is the expected

0.022000

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