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
We've run into a bit of confusion (here KSF-Media/tuttifrutti#12) with identifier parsing in our log module when using template to support variable interpolation.
While the actual issue comes from the lack of documentation in our library. I think we could eliminate such confusion by adding a "strict" mode in which, $foo won't be allowed, only ${foo}. It will also eliminate the need to escape $ with $$.
Such functionality could be added in backwards compatible way by introducing a templateStrict :: Text -> Template that has such behavior.
The text was updated successfully, but these errors were encountered:
I was thinking about this for a while. My idea was to create new module Data.Text.Template.Parse that would expose following:
dataParseOptions=ParseOptions{bracketsRequired::Bool
, escapeChar::Char}dataParseError=ParseError{sourceLocation::MaybeSrcLoc--^ Location of template parsing function in Haskell source code, if supported.
, templateLocation:: (Int, Int)
--^ Location in the template where parsing error was encountered.}parse::HasCallStack=>ParseOptions->Text->EitherParseErrorTemplate
parse = parseImpl
* Alternative API for parsing `Text` into `Template` which allows users to
specify if they want brackets to be mandatory. Instead of simple
location this API returns `ParseError` on failure.
* Function `template` throws `ParseError`, instead of calling `error`.
No other function in existing public API has (visibly) changed.
Addresses issues tibbe#13 and tibbe#14
We've run into a bit of confusion (here KSF-Media/tuttifrutti#12) with identifier parsing in our log module when using template to support variable interpolation.
While the actual issue comes from the lack of documentation in our library. I think we could eliminate such confusion by adding a "strict" mode in which,
$foo
won't be allowed, only ${foo}. It will also eliminate the need to escape$
with$$
.Such functionality could be added in backwards compatible way by introducing a
templateStrict :: Text -> Template
that has such behavior.The text was updated successfully, but these errors were encountered: