ToWidget instances for Text and friends

I have copied the body of this github issue get feedback on this suggestion: https://github.com/yesodweb/yesod/issues/1298 The ToWidget typeclass could be more helpful than it currently is. Notably, there are sensible instances for Text, lazy Text, and text Builder that are not provided. I think that one objection to introducing such classes is that there is a piece of syntax in the shakespeare quasiquoter ^{..} that calls ToWidget on its argument. Adding more instances would allow the end user to feed text into this construct, which might be undesirable. I don't use the quasiquoter for templating, so the downside of it doesn't bother me. The reason I would like these instances is because there are a number of situations where I have to call `toWidget . toHtml` in my code that could be abbreviated to toWidget if these instances were provided. If this change is at odds with the goals of the TH templating, then I wouldn't want to mess that up for people, but if not, I would find these instances useful. I would appreciate any feedback, even if it's just in the form of a +1 or -1 response without any further explanation. -Andrew Martin

CCing the Yesod mailing list, which may have more opinions.
I'm fine with the change if there are no objections. Want to send a PR?
On Wed, Nov 23, 2016 at 5:28 PM, Andrew Martin
I have copied the body of this github issue get feedback on this suggestion:
https://github.com/yesodweb/yesod/issues/1298
The ToWidget typeclass could be more helpful than it currently is. Notably, there are sensible instances for Text, lazy Text, and text Builder that are not provided. I think that one objection to introducing such classes is that there is a piece of syntax in the shakespeare quasiquoter ^{..} that calls ToWidget on its argument. Adding more instances would allow the end user to feed text into this construct, which might be undesirable.
I don't use the quasiquoter for templating, so the downside of it doesn't bother me. The reason I would like these instances is because there are a number of situations where I have to call `toWidget . toHtml` in my code that could be abbreviated to toWidget if these instances were provided. If this change is at odds with the goals of the TH templating, then I wouldn't want to mess that up for people, but if not, I would find these instances useful.
I would appreciate any feedback, even if it's just in the form of a +1 or -1 response without any further explanation.
-Andrew Martin _______________________________________________ web-devel mailing list web-devel@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/web-devel
participants (2)
-
Andrew Martin
-
Michael Snoyman