Skip to content
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

Merged
merged 4 commits into from Jul 23, 2015

Conversation

Projects
None yet
3 participants
@andrewthad
Copy link
Contributor

andrewthad commented Jul 21, 2015

@@ -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

This comment has been minimized.

Copy link
@snoyberg

snoyberg Jul 21, 2015

Member

I think you'll get better type inference with:

instance (Monad m, a ~ ()) => IsString (WidgetT site m a)

This comment has been minimized.

Copy link
@andrewthad

andrewthad Jul 21, 2015

Author Contributor

Ah! That dumb trick I always forget.

This comment has been minimized.

Copy link
@snoyberg

snoyberg Jul 21, 2015

Member

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 ()) where

Ah! 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.

@andrewthad

This comment has been minimized.

Copy link
Contributor Author

andrewthad commented Jul 21, 2015

I'll wait two days to see if there is any opposition to this, and then I'll merge the branch.

@creichert

This comment has been minimized.

Copy link
Member

creichert commented Jul 21, 2015

@andrewthad Do you mind if I push a doc string for the new instance?

@andrewthad

This comment has been minimized.

Copy link
Contributor Author

andrewthad commented Jul 21, 2015

@creichert That would be wonderful.

@andrewthad

This comment has been minimized.

Copy link
Contributor Author

andrewthad commented Jul 21, 2015

@creichert I think you might have typoed the docstring a little. It reads:

Any type with an 'IsString' instance can be trivially promoted to a widget.

I think it was supposed to be:

A 'String' can be trivially promoted to a widget.

Or something like that. Because there are lots of types (ByteString for example) that have IsString instances but can't be trivially promoted to a widget.

@creichert

This comment has been minimized.

Copy link
Member

creichert commented Jul 21, 2015

Yea, my mistake, thanks. I pushed a fix.

On Tue, Jul 21 2015, Andrew Martin notifications@github.com wrote:

@creichert I think you might have typoed the docstring a little. It reads:

Any type with an 'IsString' instance can be trivially promoted to a widget.

I think it was supposed to be:

An 'String' can be trivially promoted to a widget.

Or something like that. Because there are lots of types (ByteString for example) that have IsString instances but can't be trivially promoted to a widget.


Reply to this email directly or view it on GitHub:
#1038 (comment)

andrewthad added a commit that referenced this pull request Jul 23, 2015

Merge pull request #1038 from yesodweb/widget_isstring_instance
Add IsString instance for WidgetT site m ()

@andrewthad andrewthad merged commit 81c996f into master Jul 23, 2015

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@snoyberg snoyberg removed the in progress label Jul 23, 2015

@andrewthad andrewthad deleted the widget_isstring_instance branch Jul 23, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.