Closed
Description
Obviously Maybe a case of mis-subclassing. It leads to unobvious requirements and also makes the record much longer than it needs to be.
agda-stdlib/src/Algebra/Structures.agda
Lines 45 to 51 in a0bdb8e
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
MatthewDaggitt commentedon Mar 12, 2018
Likewise with
IsCommutativeSemiring
gallais commentedon Mar 12, 2018
I think the point of this is that an
IsCommutativeX
can be used anywhere anX
isexpected thanks to subtyping. Not sure whether it'd still be the case if everything was
packed up in a subfield.
That being said, I'm not sure how useful the subtyping aspect is.
MatthewDaggitt commentedon Mar 12, 2018
Ooh I hadn't considered that. Apologies for my too hasty comment.
Hang on, does that mean
identityˡ : LeftIdentity ε _∙_
is a subtype ofidentity : Identity ε ∙
?andreasabel commentedon Mar 12, 2018
I could imagine the reason is that in the presence of commutativity, left identity implies right identity, thus, there is less proof obligations to build a commutative monoid.
Unless there are strong reasons for change, I'd advise to leave it as-is. (Maybe add documentation to not fall into the same trap again.)
MatthewDaggitt commentedon Mar 16, 2018
Agreed.