You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and then automatically have that type implement PyFToString and all relevant mechanisms, so that when I write
let u =Username"myuser"in [fmt|There was a problem with user {u}!|]
it will use a magical formatting that we define somehow, and the result will be:
There was a problem with user "myuser"
where the quotes get automatically added by the way FormatQuote is implemented.
I don’t know if this is possible at all, but it would be cool to have somehow.
I guess the closest is the following snippet:
classFormatQuoteawhereq::a->FormatQuoteTinstanceFormatQuoteTextwhere
q t =FormatQuoteT$ textToString t
newtypeFormatQuoteT=FormatQuoteTStringtypeinstancePyF.PyFClassifyFormatQuoteT= 'PyF.PyFStringinstancePyF.PyFToStringFormatQuoteTwhere
pyfToString (FormatQuoteT s) ="\""<> s <>"\""
which lets me do
let u =Username"myuser"in [fmt|{q u}|]
"\"myuser\""
however, this means I always have to remember to use q and also the q symbol is not available in any of my code.
The text was updated successfully, but these errors were encountered:
I want to make it possible to have a simple derive clause for a newtype like
and then automatically have that type implement
PyFToString
and all relevant mechanisms, so that when I writeit will use a magical formatting that we define somehow, and the result will be:
where the quotes get automatically added by the way
FormatQuote
is implemented.I don’t know if this is possible at all, but it would be cool to have somehow.
I guess the closest is the following snippet:
which lets me do
however, this means I always have to remember to use
q
and also theq
symbol is not available in any of my code.The text was updated successfully, but these errors were encountered: