版博士V2.0程序
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { Semiring } from './Semiring'
  2. /**
  3. * @category model
  4. * @since 2.0.0
  5. */
  6. export interface Ring<A> extends Semiring<A> {
  7. readonly sub: (x: A, y: A) => A
  8. }
  9. /**
  10. * Given a tuple of `Ring`s returns a `Ring` for the tuple
  11. *
  12. * @example
  13. * import { tuple } from 'fp-ts/Ring'
  14. * import * as N from 'fp-ts/number'
  15. *
  16. * const R = tuple(N.Field, N.Field, N.Field)
  17. * assert.deepStrictEqual(R.add([1, 2, 3], [4, 5, 6]), [5, 7, 9])
  18. * assert.deepStrictEqual(R.mul([1, 2, 3], [4, 5, 6]), [4, 10, 18])
  19. * assert.deepStrictEqual(R.one, [1, 1, 1])
  20. * assert.deepStrictEqual(R.sub([1, 2, 3], [4, 5, 6]), [-3, -3, -3])
  21. * assert.deepStrictEqual(R.zero, [0, 0, 0])
  22. *
  23. * @since 2.10.0
  24. */
  25. export declare const tuple: <A extends readonly unknown[]>(
  26. ...rings: { [K in keyof A]: Ring<A[K]> }
  27. ) => Ring<Readonly<A>>
  28. /**
  29. * `negate x` can be used as a shorthand for `zero - x`
  30. *
  31. * @since 2.0.0
  32. */
  33. export declare const negate: <A>(R: Ring<A>) => (a: A) => A
  34. /**
  35. * Use [`tuple`](#tuple) instead.
  36. *
  37. * @category zone of death
  38. * @since 2.0.0
  39. * @deprecated
  40. */
  41. export declare const getTupleRing: <T extends ReadonlyArray<Ring<any>>>(
  42. ...rings: T
  43. ) => Ring<{
  44. [K in keyof T]: T[K] extends Ring<infer A> ? A : never
  45. }>
  46. /**
  47. * Use [`getRing`](./function.ts.html#getring) instead.
  48. *
  49. * @category zone of death
  50. * @since 2.0.0
  51. * @deprecated
  52. */
  53. export declare const getFunctionRing: <A, B>(R: Ring<B>) => Ring<(a: A) => B>