Skip to content

isSpace throws on Asian characters #20

@bklaric

Description

@bklaric

Minimal repro in REPL

import Prelude

import Data.Char.Unicode (isHexDigit, isPrint, isSpace)
import Data.Foldable (all)
import Data.String.CodeUnits (toCharArray)

"カタカナ" # toCharArray # all (not <<< isSpace)

Fails with

/home/bklaric/Documents/PureScript/purescript-team-tavern-server/.psci_modules/node_modules/Data.Char.Unicode.Internal/index.js:6822
        if (v.start >= v1.start && v.start < (v1.start + v1.length | 0)) {
                        ^

TypeError: Cannot read property 'start' of undefined
    at /home/bklaric/Documents/PureScript/purescript-team-tavern-server/.psci_modules/node_modules/Data.Char.Unicode.Internal/index.js:6822:27
    at $tco_loop (/home/bklaric/Documents/PureScript/purescript-team-tavern-server/.psci_modules/node_modules/Data.Char.Unicode.Internal/index.js:6793:51)
    at /home/bklaric/Documents/PureScript/purescript-team-tavern-server/.psci_modules/node_modules/Data.Char.Unicode.Internal/index.js:6810:43
    at /home/bklaric/Documents/PureScript/purescript-team-tavern-server/.psci_modules/node_modules/Data.Char.Unicode.Internal/index.js:6815:29
    at /home/bklaric/Documents/PureScript/purescript-team-tavern-server/.psci_modules/node_modules/Data.Char.Unicode.Internal/index.js:6844:60
    at Object.uIswspace (/home/bklaric/Documents/PureScript/purescript-team-tavern-server/.psci_modules/node_modules/Data.Char.Unicode.Internal/index.js:6882:62)
    at Object.isSpace (/home/bklaric/Documents/PureScript/purescript-team-tavern-server/.psci_modules/node_modules/Data.Char.Unicode/index.js:2006:39)
    at /home/bklaric/Documents/PureScript/purescript-team-tavern-server/.psci_modules/node_modules/$PSCI/index.js:13:31
    at /home/bklaric/Documents/PureScript/purescript-team-tavern-server/.psci_modules/node_modules/Control.Semigroupoid/index.js:18:22
    at /home/bklaric/Documents/PureScript/purescript-team-tavern-server/.psci_modules/node_modules/Data.Foldable/index.js:467:75

Replacing isSpace with isPrint or isHexDigit works fine.

PureScript 0.12.0
Pulp 12.3.0
purescript-unicode 4.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething that should function correctly isn't.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions