This repository was archived by the owner on Feb 8, 2022. It is now read-only.
Add Signed and TruncatedDivision typeclasses#247
Open
denisrosset wants to merge 1 commit intotypelevel:masterfrom
Open
Add Signed and TruncatedDivision typeclasses#247denisrosset wants to merge 1 commit intotypelevel:masterfrom
denisrosset wants to merge 1 commit intotypelevel:masterfrom
Conversation
This was referenced May 14, 2021
johnynek
reviewed
May 14, 2021
Contributor
johnynek
left a comment
There was a problem hiding this comment.
Very cool. Thanks for sending.
|
|
||
| def *(that: Sign): Sign = Sign(this.toInt * that.toInt) | ||
|
|
||
| def **(that: Int): Sign = this match { |
Contributor
There was a problem hiding this comment.
Can we add a comment that this is exponentiation?
| def signed(implicit A: Signed[A]) = new OrderProperties( | ||
| name = "signed", | ||
| parent = Some(order), | ||
| "abs non-negative" -> forAll((x: A) => A.sign(A.abs(x)) != Signed.Negative), |
Contributor
There was a problem hiding this comment.
Do we require that abs(x) >= x?
Seems natural to me, but I don't see that is implied.
| checkAll("Long", LatticeLaws[Long].boundedDistributiveLattice) | ||
|
|
||
| // catsKernelStdOrderForBigInt | ||
| checkAll("BigInt", OrderLaws[BigInt].truncatedDivision) |
Contributor
There was a problem hiding this comment.
Can we add implementations for the specialized things?
Contributor
Author
There was a problem hiding this comment.
Same comment as for the intermediate ring structures-- the instances are only approximations due to the type limited range.
armanbilge
added a commit
to armanbilge/cats
that referenced
this pull request
Jun 5, 2021
Partially merges typelevel/algebra#247
18 tasks
pikinier20
pushed a commit
to pikinier20/cats
that referenced
this pull request
Oct 25, 2021
Partially merges typelevel/algebra#247
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This follows the Spire implementations as well (we just put
Signinto theSignedcompanion object).We added the missing companion object functions.