Drop unicode dependency?
Closed this issue · 5 comments
Does the unicode dependency make the bundle size much larger?
https://discourse.purescript.org/t/dear-purescript-parsing-users/2620/9
Also add takeWhileP
https://discourse.purescript.org/t/dear-purescript-parsing-users/2620/9
So, as @natefaubion pointed out on Discourse, the large bundle sizes from unicode are due to the lookup tables.
A program which runs runParser "a" (char 'a'):
spago -x spago-dev.dhall bundle-module --main Test.Unicode --platform node --minify
[info] Build succeeded.
index.js 13.7kb
A program which runs runParser "a" letter:
spago -x spago-dev.dhall bundle-module --main Test.Unicode --platform node --minify
[info] Build succeeded.
index.js 150.4kb
I added some documentation about unicode bundle size in v9.1.0 explaining that if none of the unicode-dependent functions are used then all of the unicode package will be eliminated by dead-code-elimination. https://pursuit.purescript.org/packages/purescript-parsing/9.1.0/docs/Parsing.String.Basic
The unicode parsers in Basic like i.e. upper are slightly more useful than satisfyCodePoint isUpper because they return a Char rather than a CodePoint. So that's a reason to keep them. They encode the knowledge that in fact all of the Unicode uppercase characters are members of the Basic Multilingual Plane, and that knowledge is not otherwise available to the type system.