Where name and age could be any haskell expression.
GHC 9.12 will already have multiline string with prefix removed.
So compared to GHC with native string interpolation, what is the added value of PyF? Well, simple, formatting.
However, PyF requires template haskell and for this reason the library had never really found its users (I don't see any reason, if you know why, please share).
Another of the niceties of PyF, from my point of view, is the compact formatting expression minilanguage (which can be a nightmare if you want to use all possible options), which is also well known (because used in python and inspired by printf, ...).
So I'm thinking about introducing a library in PyF able to be used in a compact way inside string interpolation. For example, the former:
```haskell
[fmt|Name: {name}, age: {age:.2}|]
Could be turned to:
f"Name: ${name}, age: ${#".2" age}
The idea is to lift the formatting mini language to a symbol / label. Error reporting won't be as nice as what we currently have in PyF (e.g. no carret into the mini language).
https://github.com/ghc-proposals/ghc-proposals/pull/570#issuecomment-2277426700 is a GHC proposal which will introduce native string interpolation in GHC, in a syntax like:
Where
name
andage
could be any haskell expression.GHC 9.12 will already have multiline string with prefix removed.
So compared to GHC with native string interpolation, what is the added value of PyF? Well, simple, formatting.
However, PyF requires template haskell and for this reason the library had never really found its users (I don't see any reason, if you know why, please share).
Another of the niceties of PyF, from my point of view, is the compact formatting expression minilanguage (which can be a nightmare if you want to use all possible options), which is also well known (because used in python and inspired by printf, ...).
So I'm thinking about introducing a library in PyF able to be used in a compact way inside string interpolation. For example, the former:
Could be turned to:
The idea is to lift the formatting mini language to a symbol / label. Error reporting won't be as nice as what we currently have in PyF (e.g. no carret into the mini language).
Any idea ?