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
It would be great to have a postProcess-style hook that applied to each interpolated expression. This would make it much easier to customize the exact behavior of the quasiquoter while reusing the interpolation and Haskell-expression-parsing machinery from this package.
I haven't really thought the design through yet, but it would be neat if the Python formatting DSL could be factored out as a function—that would leave people with a lot of flexibility around how to handle interpolation.
I've run into two situations where this level of flexibility would have been useful:
Interpolating for code generation where it would be nice to restrict expressions to a domain-specific newtype or even automatically manage language-specific things like quoting and name resolution
Unfortunately, none of the Haskell interpolation libraries I've looked at are flexible enough for this kind of use.
Is this kind of usecase something you'd be interested in supporting in PyF? If it is, I'm happy to try my hand at writing a PR, although I'd appreciate suggestions on how to fit it into the existing design of the library. Alternatively, I could see this fitting more into a library for writing quasiquoters rather than PyF, but I'm not sure if any library like that currently exists.
The text was updated successfully, but these errors were encountered:
It would be great to have a
postProcess
-style hook that applied to each interpolated expression. This would make it much easier to customize the exact behavior of the quasiquoter while reusing the interpolation and Haskell-expression-parsing machinery from this package.I haven't really thought the design through yet, but it would be neat if the Python formatting DSL could be factored out as a function—that would leave people with a lot of flexibility around how to handle interpolation.
I've run into two situations where this level of flexibility would have been useful:
Integrating with some class to display user-facing values (ie
Display
or something internal)Interpolating for code generation where it would be nice to restrict expressions to a domain-specific newtype or even automatically manage language-specific things like quoting and name resolution
Unfortunately, none of the Haskell interpolation libraries I've looked at are flexible enough for this kind of use.
Is this kind of usecase something you'd be interested in supporting in PyF? If it is, I'm happy to try my hand at writing a PR, although I'd appreciate suggestions on how to fit it into the existing design of the library. Alternatively, I could see this fitting more into a library for writing quasiquoters rather than PyF, but I'm not sure if any library like that currently exists.
The text was updated successfully, but these errors were encountered: