Improve laziness for strings#42
Conversation
|
@andrew-lei Would you be able to review this one as well? If it looks good, you can merge it and make a new release if you want. Here is a release checklist: https://functor.tokyo/blog/2018-07-16-release-haskell-packages-to-hackage |
|
Travis failed this for the test that was implemented yesterday. This could be remedied, but it depends on what The proposed code will parse string literals from a shown string to a literal string. I believe I had wanted to do something along those lines, but there is the problem of malformed input (non-existent escaped characters). The case is accounted for, but results in ambiguity. For example, > parseStringLit "\\c\""
("\\c","")
> parseStringLit "\\\\c\""
("\\c","")This would only be the case for a very unusual show instance. For instance, consider data Foo = Foo
instance Show Foo where
show Foo = "\"\\c\\\\c\""In which case > pPrintNoColor Foo
"\c\c"It's a pretty weird edge case that is probably unlikely to occur, but that's why I wanted to have the parser preserve the strings verbatim. |
By parsing one character at a time with
Data.Char.readLitChar, we can avoid the need to read the entire string at once.