Help implementing Multiline String Literals
Viktor Dukhovni
ietf-dane at dukhovni.org
Thu Feb 8 15:14:23 UTC 2024
On Thu, Feb 08, 2024 at 03:09:37PM +0000, Matthew Pickering wrote:
> I would imagine you modify the lexer like you describe, but it's not
> clear to me you want to use the same constructor `HsString` to
> represent them all the way through the compiler.
>
> If you reuse HsString then how to you distinguish between a string
> which contains a newline and a multi-line string for example? It just
> seems simpler to me to explicitly represent a multi-line string..
> perhaps `HsMultiLineString [String]` rather than trying to shoehorn
> them together and run into subtle bugs like this.
Compiler-aside, how first-class are multi-line strings expected to be?
Should `Read` instances also be able to handle multi-line strings?
Arguably, valid source syntax should be valid syntax for `Read`?
--
Viktor.
More information about the ghc-devs
mailing list