checkEuclideanRing
Opened this issue · 3 comments
Do we know why the checkEuclideanRing can't pass?
purescript-js-bigints/test/Main.purs
Line 128 in e026a78
Is it is similar situation to Data.Int64?
If i understand correctly, there is no hard max on the size of BigInt, it's limited only by memory of the machine. In which case I think it makes sense to just use the absolute value like you would for the integers. I have confirmed that these tests pass in this case.
Sorry to reopen a closed issue.
I think the fixed implement of degree is not correct even if the tests pass.
export const biDegree = (x) => {
return x < 0n ? -x : x;
}This is because the method degree must return an Int (not a BigInt) and the fixed implementation returns a JavascriptBigInt (with Purescript Type Int)
This can be a problem if, for example, we try to do something like degree (BigInt.fromInt 2) + 2 which will be well typed but will cause a runtime error (because Javascript does not allow to add a BigInt and an Int
Actually, I think there is no way to correctly implement degree (without changing the type of the method) but at least the previous implementation returns the good type.
Given the above, I'm reopening this.