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 Function as Monoid #2

Merged
merged 3 commits into from May 25, 2020
Merged

add Function as Monoid #2

merged 3 commits into from May 25, 2020

Conversation

stevemao
Copy link
Member

No description provided.

Copy link

@sinogermany sinogermany left a 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

README.md Show resolved Hide resolved
Comment on lines +164 to +165
f x = f1 x <> mempty
f = f1 <> mempty

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.

Copy link
Member Author

@stevemao stevemao May 23, 2020

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?

@sinogermany sinogermany mentioned this pull request May 23, 2020

-- | @since 2.01
instance Monoid b => Monoid (a -> b) where
mempty _ = mempty
Copy link
Member

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

Copy link
Member Author

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

@stevemao stevemao merged commit e018268 into master May 25, 2020
@stevemao stevemao deleted the feat/monoid branch May 25, 2020 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants