With this library you can parse inline HTML at compile time and produce MarkupM terms for blaze-markup and blaze-html. I imagine this can play nicely with server-side web frameworks such as HTMX and scotty (cc @piq9117 ^^).
This proved to be more challenging than expected but it does in fact work nicely.
I’d appreciate if someone with TH experience could chime in with ways to clean up the recursive production of a Q Exp term; auto-deriving Lift for the blaze types does not work.
And from your description, it’s not necessarily a bad thing. Shakespeare is highly associated with Yesod, and from its description, it’s less discoverable.
If you’re calling your library a simplified version of Shakespeare, then, besides trying to provide a core, simplified functionality, you can also try to focus on documentation, as well as making it accessible to newer / lesser-skilled users.
Even if, ultimately, you and others might decide that this is not good enough to publish on Hackage, it’s good practice on the documentation front.
You might also find some inspiration for the interpolation code in ihp-hsx (which is the standalone package of the IHP JSX-like quasiquoter. It’s actually also based on blaze). ihp-hsx: JSX-like but for Haskell
It uses the GHC parser to parse the expressions between {} and then converts that to the TH data structures. We took the idea from the PyF library
Thank you @silky and @mpscholten ! I agree having function-like templates would make the library more flexible on the Haskell side, but one would lose the 1:1 correspondence with HTML, which is also handy when building up web views.
I think ultimately this is a matter of taste and “product” vision rather than a “why not” technical decision, which is why it makes sense when integrating tightly with a framework such as Yesod or IHP and less so with a general-purpose library, in my view.
Makes sense @ocramz ; but do let me clarify one minor point - shakespeare is not quite married to yesod; I use it happily in a servant environment in combination with servant-blaze.