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

Import '(<>)' from Semigroup, not Monoid #79

Closed
chshersh opened this issue Nov 5, 2017 · 8 comments
Closed

Import '(<>)' from Semigroup, not Monoid #79

chshersh opened this issue Nov 5, 2017 · 8 comments

Comments

@chshersh
Copy link
Contributor

chshersh commented Nov 5, 2017

For example, it's not very convenient to use Semigroup.<> when you need to append NonEmpty a.

@neongreen
Copy link
Contributor

neongreen commented Nov 5, 2017

We already had (<>) from Semigroup in Universum and then we changed it because it was too much hassle ;)

@chshersh
Copy link
Contributor Author

chshersh commented Nov 5, 2017

@neongreen Can you give an example of that? Probably I didn't face this issue...

@neongreen
Copy link
Contributor

neongreen commented Nov 5, 2017

IIRC there were some types without Semigroup instances and so we had to import the Monoid (<>) fairly often. I don't remember which types those were.

@int-index
Copy link
Member

We should've added Semigroup instances upstream, since it's in base

@neongreen
Copy link
Contributor

Meanwhile I have found the relevant commit and it looks like there were only six modules where we had to hide (<>) from Universum. We are also using NonEmpty more often now so I guess I'm fine with exporting (<>) from Semigroup instead of Monoid provided that we also export mappend.

@chshersh
Copy link
Contributor Author

chshersh commented Nov 5, 2017

We can just use mappend if we need Monoid.
When Semigroup => Monoid lands in GHC 8.4.1 it will become much easier to migrate. Especially if we try by ourselves to use Semigroup instead of Monoid as much as possible.

@gromakovsky
Copy link
Member

IIRC, most annoying example was some famous type from optparse-applicative.

@chshersh
Copy link
Contributor Author

chshersh commented Nov 6, 2017

@gromakovsky This data type has instance Semigroup in last version of optparse-applicative.

@chshersh chshersh added this to the v1.0.0 milestone Nov 13, 2017
chshersh added a commit that referenced this issue Nov 25, 2017
[#79] Import (<>) from Semogroup not Monoid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants