-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add IsString instance for WidgetT site m () #1038
Conversation
@@ -250,6 +250,10 @@ instance (a ~ (), Monad m) => Monoid (WidgetT site m a) where | |||
mempty = return () | |||
mappend x y = x >> y | |||
instance (a ~ (), Monad m) => Semigroup (WidgetT site m a) | |||
instance Monad m => IsString (WidgetT site m ()) where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you'll get better type inference with:
instance (Monad m, a ~ ()) => IsString (WidgetT site m a)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! That dumb trick I always forget.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only remembered because the previous instance uses it
On Tue, Jul 21, 2015, 8:36 AM Andrew Martin notifications@github.com
wrote:
In yesod-core/Yesod/Core/Types.hs
#1038 (comment):@@ -250,6 +250,10 @@ instance (a ~ (), Monad m) => Monoid (WidgetT site m a) where
mempty = return ()
mappend x y = x >> y
instance (a ~ (), Monad m) => Semigroup (WidgetT site m a)
+instance Monad m => IsString (WidgetT site m ()) whereAh! That dumb trick I always forget.
—
Reply to this email directly or view it on GitHub
https://github.com/yesodweb/yesod/pull/1038/files#r35116687.
I'll wait two days to see if there is any opposition to this, and then I'll merge the branch. |
@andrewthad Do you mind if I push a doc string for the new instance? |
@creichert That would be wonderful. |
@creichert I think you might have typoed the docstring a little. It reads:
I think it was supposed to be:
Or something like that. Because there are lots of types ( |
Yea, my mistake, thanks. I pushed a fix. On Tue, Jul 21 2015, Andrew Martin notifications@github.com wrote:
|
Add IsString instance for WidgetT site m ()
#1037