Skip to content

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.

Co-authored-by: Gary Burgess <gary.burgess@gmail.com>
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