External Publication
Visit Post

Final call for GHC String Interpolation proposal!

Haskell Community [Unofficial] June 12, 2026
Source

Ideally, text would have the following support:

  • Normal s"..." with overloaded strings (uses default Interpolate class, concats with String, final fromString)
  • Basic.s"..." an interpolator shipped from GHC that doesnt do any implicit interpolation, just concats
  • Data.Text.s"..." would use the default Interpolate class that concats with Text and rewrite rules for performance
    • Same for LazyText and Builder

The first two bullets are free, text gets it out of the box. The third bullet needs to be implemented by text. Text could also choose to implement other interpolators if it wants, e.g. an interpolator using its own TextInterpolate class. But TextInterpolate should be unnecessary; my benchmark shows that rewrite rules with the default Interpolate class is equally performant.

If it’s not clear what the difference between the first and third bullet is, it’s essentially the difference between

Text.pack ("age: " <> show age)

Text.pack "age: " <> (Text.pack . show) age

Discussion in the ATmosphere

Loading comments...