-
Notifications
You must be signed in to change notification settings - Fork 8
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
Implements Monoid
interface/typeclass.
#26
Implements Monoid
interface/typeclass.
#26
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.
please rebase over master
(I force pushed...)
src/Typeclass/Monoid.php
Outdated
namespace Marcosh\LamPHPda\Typeclass; | ||
|
||
/** | ||
* @psalm-immutable |
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.
please restructure the annotations as per https://github.com/marcosh/lamphpda/blob/master/adr/2021-10-21-how-to-write-annotations.md
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.
Job done!
src/Typeclass/Monoid.php
Outdated
* | ||
* @return Monoid<A> | ||
*/ | ||
public static function mempty(): Monoid; |
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.
mempty
should return something of type A
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.
Job done!
Stupid question, where do you get this information from? Where is it documented that mempty
should return A
?
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.
short answer: here
longer answer: see https://github.com/marcosh/lamphpda/blob/master/adr/2021-10-22-typeclass-instances-are-their-own-objects.md
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.
Excellent, thanks!!!
27c4ae0
to
cfbf453
Compare
This PR:
Monoid
implementations #16