Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get Text String #393

Open
ScottFreeCode opened this issue Oct 19, 2021 · 1 comment
Open

How to get Text String #393

ScottFreeCode opened this issue Oct 19, 2021 · 1 comment
Labels
AST Concerning the generated abstract syntax builtin Concerning built-in tokens like Integer, String etc. enhancement Haskell token Concerning token categories.

Comments

@ScottFreeCode
Copy link

I turned on the new --text-token option – thank you for that, by the way! – but String is the one thing still parsed into a Haskell String ([Char]) rather than Text and I have to pack it.

I suspect my case for parsing tokens as Text isn't the most common (I'm feeding them into another library that takes Text), but I would think strings commonly should be Text since they're more likely to contain human language than tokens are.

Could an option be added for Text strings? Perhaps separate from --text-token for anyone who wants Text strings but still wants bytestring tokens?

@andreasabel andreasabel added AST Concerning the generated abstract syntax builtin Concerning built-in tokens like Integer, String etc. enhancement Haskell token Concerning token categories. labels Oct 19, 2021
@andreasabel
Copy link
Member

andreasabel commented Oct 19, 2021

Could an option be added for Text strings? Perhaps separate from --text-token for anyone who wants Text strings but still wants bytestring tokens?

This is a good suggestion.

There are related feature request for flexibility in the representation of token types in the AST:

Maybe #267 would be a way to in general be more flexible in the Haskell ASTs.

However, it is also thinkable to make Haskell ASTs more polymorphic in the sense that the String tokens can be represented by anything that implements the IsString class (roughly; maybe we need own classes). There would be two specializations, one for String and one for Text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AST Concerning the generated abstract syntax builtin Concerning built-in tokens like Integer, String etc. enhancement Haskell token Concerning token categories.
Projects
None yet
Development

No branches or pull requests

2 participants