Overview
The Ring
class is for types that support addition, multiplication, and subtraction operations.
Instances must satisfy the following law in addition to the Semiring
laws:
- Additive inverse:
a - a = (zero - a) + a = zero
Adapted from https://github.com/purescript/purescript-prelude/blob/master/src/Data/Ring.purs
Table of contents
- Ring (interface)
- getFunctionRing (function)
getProductRing(function)- getTupleRing (function)
- negate (function)
Ring (interface)
Signature
export interface Ring<A> extends Semiring<A> {
readonly sub: (x: A, y: A) => A
}
Added in v1.0.0
getFunctionRing (function)
Signature
export const getFunctionRing = <A, B>(ring: Ring<B>): Ring<(a: A) => B> => ...
Added in v1.0.0
getProductRing (function)
Use getTupleRing
instead
Signature
export const getProductRing = <A, B>(RA: Ring<A>, RB: Ring<B>): Ring<[A, B]> => ...
Added in v1.0.0
getTupleRing (function)
Signature
export const getTupleRing = <A, B>(RA: Ring<A>, RB: Ring<B>): Ring<[A, B]> => ...
Added in v1.14.3
negate (function)
negate x
can be used as a shorthand for zero - x
Signature
export const negate = <A>(ring: Ring<A>) => (a: A): A => ...
Added in v1.0.0