Open ScottFreeCode opened 3 years ago
Could an option be added for
Text
strings? Perhaps separate from--text-token
for anyone who wantsText
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
.
I turned on the new
--text-token
option – thank you for that, by the way! – butString
is the one thing still parsed into a HaskellString
([Char]
) rather thanText
and I have topack
it.I suspect my case for parsing tokens as
Text
isn't the most common (I'm feeding them into another library that takesText
), but I would think strings commonly should beText
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 wantsText
strings but still wants bytestring tokens?