Skip to content

Adds semigroup and monoid instances for Cofree #116

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

Merged
merged 2 commits into from
Sep 9, 2021
Merged

Adds semigroup and monoid instances for Cofree #116

merged 2 commits into from
Sep 9, 2021

Conversation

mikesol
Copy link

@mikesol mikesol commented Sep 8, 2021

Description of the change

The purpose of the pull request is to decrease the burden on library writers of creating newtypes for Cofree when they want semigroup and monoid instances. For example, in https://github.com/mikesol/purescript-wags-lib/blob/main/src/WAGS/Lib/Rate.purs and many other files in that project, custom Semigroup and Monoid instances are created using this pattern, which leads to lots of code duplication.

From my testing, it seems that these follow the Semigroup and Monoid laws.


Checklist:

  • Added the change to the changelog's "Unreleased" section with a reference to this PR (e.g. "- Made a change (#0000)")
  • Linked any existing issues or proposals that this pull request should close
  • Updated or added relevant documentation
  • Added a test for the contribution (if applicable)

Copy link
Member

@thomashoneyman thomashoneyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me, but I'd like to leave this open for a little while so folks more familiar with Cofree (which I've rarely used) can weigh in. If no one else does, then I'm happy to merge in a week or so.

Copy link
Member

@garyb garyb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems sensible to me!

@thomashoneyman thomashoneyman merged commit 065d1e1 into purescript:master Sep 9, 2021
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.

3 participants