版博士V2.0程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

84 строки
1.9 KiB

  1. /**
  2. * @since 2.0.0
  3. */
  4. import { Comonad2C } from './Comonad'
  5. import { Functor2 } from './Functor'
  6. import { Monoid } from './Monoid'
  7. /**
  8. * @category model
  9. * @since 2.0.0
  10. */
  11. export interface Traced<P, A> {
  12. (p: P): A
  13. }
  14. /**
  15. * Extracts a value at a relative position which depends on the current value.
  16. *
  17. * @since 2.0.0
  18. */
  19. export declare function tracks<P, A>(M: Monoid<P>, f: (a: A) => P): (wa: Traced<P, A>) => A
  20. /**
  21. * Get the current position
  22. *
  23. * @since 2.0.0
  24. */
  25. export declare function listen<P, A>(wa: Traced<P, A>): Traced<P, [A, P]>
  26. /**
  27. * Get a value which depends on the current position
  28. *
  29. * @since 2.0.0
  30. */
  31. export declare function listens<P, B>(f: (p: P) => B): <A>(wa: Traced<P, A>) => Traced<P, [A, B]>
  32. /**
  33. * Apply a function to the current position
  34. *
  35. * @since 2.0.0
  36. */
  37. export declare function censor<P>(f: (p: P) => P): <A>(wa: Traced<P, A>) => Traced<P, A>
  38. /**
  39. * @category instances
  40. * @since 2.0.0
  41. */
  42. export declare function getComonad<P>(monoid: Monoid<P>): Comonad2C<URI, P>
  43. /**
  44. * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
  45. * use the type constructor `F` to represent some computational context.
  46. *
  47. * @category mapping
  48. * @since 2.0.0
  49. */
  50. export declare const map: <A, B>(f: (a: A) => B) => <E>(fa: Traced<E, A>) => Traced<E, B>
  51. /**
  52. * @category type lambdas
  53. * @since 2.0.0
  54. */
  55. export declare const URI = 'Traced'
  56. /**
  57. * @category type lambdas
  58. * @since 2.0.0
  59. */
  60. export declare type URI = typeof URI
  61. declare module './HKT' {
  62. interface URItoKind2<E, A> {
  63. readonly [URI]: Traced<E, A>
  64. }
  65. }
  66. /**
  67. * @category instances
  68. * @since 2.7.0
  69. */
  70. export declare const Functor: Functor2<URI>
  71. /**
  72. * @category mapping
  73. * @since 2.10.0
  74. */
  75. export declare const flap: <A>(a: A) => <E, B>(fab: Traced<E, (a: A) => B>) => Traced<E, B>
  76. /**
  77. * Use [`Functor`](#functor) instead.
  78. *
  79. * @category zone of death
  80. * @since 2.0.0
  81. * @deprecated
  82. */
  83. export declare const traced: Functor2<URI>