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

202 строки
5.0 KiB

  1. /**
  2. * @since 2.5.0
  3. */
  4. import { Applicative2C } from './Applicative'
  5. import { Apply2C } from './Apply'
  6. import { Bifunctor2 } from './Bifunctor'
  7. import { Chain2C } from './Chain'
  8. import { ChainRec2C } from './ChainRec'
  9. import { Comonad2 } from './Comonad'
  10. import { Foldable2 } from './Foldable'
  11. import { Functor2 } from './Functor'
  12. import { Monad2C } from './Monad'
  13. import { Monoid } from './Monoid'
  14. import { Semigroup } from './Semigroup'
  15. import { Semigroupoid2 } from './Semigroupoid'
  16. import { PipeableTraverse2, Traversable2 } from './Traversable'
  17. /**
  18. * @since 2.5.0
  19. */
  20. export declare function fst<A, E>(ea: readonly [A, E]): A
  21. /**
  22. * @since 2.5.0
  23. */
  24. export declare function snd<A, E>(ea: readonly [A, E]): E
  25. /**
  26. * @since 2.5.0
  27. */
  28. export declare const swap: <A, E>(ea: readonly [A, E]) => readonly [E, A]
  29. /**
  30. * @category instances
  31. * @since 2.5.0
  32. */
  33. export declare function getApply<S>(S: Semigroup<S>): Apply2C<URI, S>
  34. /**
  35. * @category instances
  36. * @since 2.5.0
  37. */
  38. export declare function getApplicative<M>(M: Monoid<M>): Applicative2C<URI, M>
  39. /**
  40. * @category instances
  41. * @since 2.5.0
  42. */
  43. export declare function getChain<S>(S: Semigroup<S>): Chain2C<URI, S>
  44. /**
  45. * @category instances
  46. * @since 2.5.0
  47. */
  48. export declare function getMonad<M>(M: Monoid<M>): Monad2C<URI, M>
  49. /**
  50. * @category instances
  51. * @since 2.5.0
  52. */
  53. export declare function getChainRec<M>(M: Monoid<M>): ChainRec2C<URI, M>
  54. /**
  55. * Map a pair of functions over the two type arguments of the bifunctor.
  56. *
  57. * @category mapping
  58. * @since 2.5.0
  59. */
  60. export declare const bimap: <E, G, A, B>(
  61. mapSnd: (e: E) => G,
  62. mapFst: (a: A) => B
  63. ) => (fa: readonly [A, E]) => readonly [B, G]
  64. /**
  65. * Map a function over the first component of a `ReadonlyTuple`.
  66. *
  67. * This is the `map` operation of the `Functor` instance.
  68. *
  69. * @category mapping
  70. * @since 2.10.0
  71. */
  72. export declare const mapFst: <A, B>(f: (a: A) => B) => <E>(fa: readonly [A, E]) => readonly [B, E]
  73. /**
  74. * Map a function over the second component of a `ReadonlyTuple`.
  75. *
  76. * This is the `mapLeft` operation of the `Bifunctor` instance.
  77. *
  78. * @category mapping
  79. * @since 2.10.0
  80. */
  81. export declare const mapSnd: <E, G>(f: (e: E) => G) => <A>(fa: readonly [A, E]) => readonly [A, G]
  82. /**
  83. * @since 2.5.0
  84. */
  85. export declare const compose: <A, B>(ab: readonly [B, A]) => <C>(bc: readonly [C, B]) => readonly [C, A]
  86. /**
  87. * @since 2.5.0
  88. */
  89. export declare const extend: <E, A, B>(f: (wa: readonly [A, E]) => B) => (wa: readonly [A, E]) => readonly [B, E]
  90. /**
  91. * @category Extract
  92. * @since 2.6.2
  93. */
  94. export declare const extract: <E, A>(wa: readonly [A, E]) => A
  95. /**
  96. * @since 2.5.0
  97. */
  98. export declare const duplicate: <E, A>(wa: readonly [A, E]) => readonly [readonly [A, E], E]
  99. /**
  100. * @category folding
  101. * @since 2.5.0
  102. */
  103. export declare const reduce: <A, B>(b: B, f: (b: B, a: A) => B) => <E>(fa: readonly [A, E]) => B
  104. /**
  105. * @category folding
  106. * @since 2.5.0
  107. */
  108. export declare const foldMap: <M>(M: Monoid<M>) => <A>(f: (a: A) => M) => <E>(fa: readonly [A, E]) => M
  109. /**
  110. * @category folding
  111. * @since 2.5.0
  112. */
  113. export declare const reduceRight: <A, B>(b: B, f: (a: A, b: B) => B) => <E>(fa: readonly [A, E]) => B
  114. /**
  115. * @category traversing
  116. * @since 2.6.3
  117. */
  118. export declare const traverse: PipeableTraverse2<URI>
  119. /**
  120. * @category traversing
  121. * @since 2.6.3
  122. */
  123. export declare const sequence: Traversable2<URI>['sequence']
  124. /**
  125. * @category type lambdas
  126. * @since 2.5.0
  127. */
  128. export declare const URI = 'ReadonlyTuple'
  129. /**
  130. * @category type lambdas
  131. * @since 2.5.0
  132. */
  133. export declare type URI = typeof URI
  134. declare module './HKT' {
  135. interface URItoKind2<E, A> {
  136. readonly [URI]: readonly [A, E]
  137. }
  138. }
  139. /**
  140. * @category instances
  141. * @since 2.7.0
  142. */
  143. export declare const Functor: Functor2<URI>
  144. /**
  145. * @category mapping
  146. * @since 2.10.0
  147. */
  148. export declare const flap: <A>(a: A) => <E, B>(fab: readonly [(a: A) => B, E]) => readonly [B, E]
  149. /**
  150. * Alias of [`mapFst`](#mapfst).
  151. *
  152. * @category mapping
  153. * @since 2.5.0
  154. */
  155. export declare const map: <A, B>(f: (a: A) => B) => <E>(fa: readonly [A, E]) => readonly [B, E]
  156. /**
  157. * Alias of [`mapSnd`](#mapsnd).
  158. *
  159. * @category error handling
  160. * @since 2.5.0
  161. */
  162. export declare const mapLeft: <E, G>(f: (e: E) => G) => <A>(fa: readonly [A, E]) => readonly [A, G]
  163. /**
  164. * @category instances
  165. * @since 2.7.0
  166. */
  167. export declare const Bifunctor: Bifunctor2<URI>
  168. /**
  169. * @category instances
  170. * @since 2.7.0
  171. */
  172. export declare const Semigroupoid: Semigroupoid2<URI>
  173. /**
  174. * @category instances
  175. * @since 2.7.0
  176. */
  177. export declare const Comonad: Comonad2<URI>
  178. /**
  179. * @category instances
  180. * @since 2.7.0
  181. */
  182. export declare const Foldable: Foldable2<URI>
  183. /**
  184. * @category instances
  185. * @since 2.7.0
  186. */
  187. export declare const Traversable: Traversable2<URI>
  188. /**
  189. * This instance is deprecated, use small, specific instances instead.
  190. * For example if a function needs a `Functor` instance, pass `RT.Functor` instead of `RT.readonlyTuple`
  191. * (where `RT` is from `import RT from 'fp-ts/ReadonlyTuple'`)
  192. *
  193. * @category zone of death
  194. * @since 2.5.0
  195. * @deprecated
  196. */
  197. export declare const readonlyTuple: Semigroupoid2<URI> &
  198. Bifunctor2<URI> &
  199. Comonad2<URI> &
  200. Foldable2<URI> &
  201. Traversable2<URI>