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 Function as Monoid #2
Conversation
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.
Great stuff! I've left some minor comments but looks awesome overall. Thanks for this PR @stevemao
f x = f1 x <> mempty | ||
f = f1 <> mempty |
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.
Not sure if it's useful for composition :).
But it is indeed a good brain exercise.
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.
@shineli1984 Yeah I wonder if there's any real life examples/usage of using this one?
|
||
-- | @since 2.01 | ||
instance Monoid b => Monoid (a -> b) where | ||
mempty _ = mempty |
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’m wondering if it’s better to write mempty = const mempty
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.
This is just copy paste, same as other code under GHC Source Code
No description provided.