Haskell has the Integral typeclass which includes Integer, Int, Int32, Int64, Natural, etc.
Is there a similar typeclass in Purescript?
We don't have any integer-specific classes in PureScript, but there is a hierarchy of numeric classes:

Each class adds laws, so although the CommutativeRing and Field classes have no operations they are not redundant.
Any type that is a EuclideanRing also satisfies the laws for integral domains, which generalise integers, so I think that should suit your needs.
Fields have non-zero multiplicative inverses: mod a b = 0 for all a and b, so using that constraint would rule out the possibility of integer division, etc. if that's what you're looking for, so you definitely don't want to that far down the hierarchy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With