GHC String Interpolation - Final Survey

Yes, that’s what I mean. Is it not possible to directly construct a Text value? If not, does this affect runtime?

correction: silently truncated bytestring (Char8). So unicode doesn’t work.

3 Likes

Let me say it like this: s"a ${x} b" :: Text will have the same runtime performance as "a " <> x <> " b" :: Text (where x :: Text), for all of the options. Does that answer your question?

@hasufell ah sure, yes. Interpolated strings will inherit the same limitations as overloaded strings.

1 Like

The typeclass mechanisms relies on user-visible internals, right? Maybe I’m misunderstanding (and please do let me know if I’m wrong), but wouldn’t there be a pressure to keep this typeclass stable/immutable because implementation details have leaked into the end-users’ programs?

Ah yes, you’re right. Any option that lets users specify how to interpolate their values has implementation visible to the user. That is, all of them, except explicit.

I don’t think there’s a way around it. Although we could mark the extension as experimental and change it in future versions