[m-users.] Proposal: Haskell-style string literals
Volker Wysk
post at volker-wysk.de
Mon Nov 3 21:24:36 AEDT 2025
Am Montag, dem 03.11.2025 um 21:13 +1100 schrieb Zoltan Somogyi:
>
>
> On Mon, 03 Nov 2025 11:08:38 +0100, Volker Wysk <post at volker-wysk.de>
> wrote:
>
> > Hi!
> >
> > Haskell has a neat syntax for strings that span mulitple lines. It looks
> > like this:
> >
> > foo = "This is a long string \
> > \literal that doesn't \
> > \fit on one line."
>
> What does this get you that you don't get with
>
> foo = "This is a long string" ++
> "literal that doesn't" ++
> "fit on one line."
>
> ?
>
> The string concatenations are done at compile time either way.
It's somewhat more verbose and the string concatenations were done at
compile time only in a high optimisation level. There was a discussion here
on the list. It feels like it was a few months ago. It was about compile
time evaluation of operations, where it was suggested by someone from the
Mercury team, to do string operations at compile time. Looks like this
suggestion has been taken meanwhile, since you say this.
Cheers,
Volker
More information about the users
mailing list