[web-devel] ToWidget instances for Text and friends

Andrew Martin andrew.thaddeus at gmail.com
Wed Nov 23 15:28:56 UTC 2016


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


More information about the web-devel mailing list