版博士V2.0程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

43 rivejä
1.1 KiB

  1. import { Semigroup } from './Semigroup'
  2. /**
  3. * Return a semigroup which works like `Object.assign`.
  4. *
  5. * @example
  6. * import { getAssignSemigroup } from 'fp-ts/struct'
  7. *
  8. * interface Person {
  9. * readonly name: string
  10. * readonly age: number
  11. * }
  12. *
  13. * const S = getAssignSemigroup<Person>()
  14. * assert.deepStrictEqual(S.concat({ name: 'name', age: 23 }, { name: 'name', age: 24 }), { name: 'name', age: 24 })
  15. *
  16. * @category instances
  17. * @since 2.10.0
  18. */
  19. export declare const getAssignSemigroup: <A extends object = never>() => Semigroup<A>
  20. /**
  21. * Creates a new object by recursively evolving a shallow copy of `a`, according to the `transformation` functions.
  22. *
  23. * @example
  24. * import { pipe } from 'fp-ts/function'
  25. * import { evolve } from 'fp-ts/struct'
  26. *
  27. * assert.deepStrictEqual(
  28. * pipe(
  29. * { a: 'a', b: 1 },
  30. * evolve({
  31. * a: (a) => a.length,
  32. * b: (b) => b * 2
  33. * })
  34. * ),
  35. * { a: 1, b: 2 }
  36. * )
  37. *
  38. * @since 2.11.0
  39. */
  40. export declare const evolve: <A, F extends { [K in keyof A]: (a: A[K]) => unknown }>(
  41. transformations: F
  42. ) => (a: A) => { [K_1 in keyof F]: ReturnType<F[K_1]> }