版博士V2.0程序
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FunctorWithIndex.d.ts 6.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. import {
  2. Functor,
  3. Functor1,
  4. Functor2,
  5. Functor2C,
  6. Functor3,
  7. Functor3C,
  8. Functor4,
  9. FunctorComposition,
  10. FunctorComposition11,
  11. FunctorComposition12,
  12. FunctorComposition12C,
  13. FunctorComposition21,
  14. FunctorComposition22,
  15. FunctorComposition22C,
  16. FunctorComposition2C1
  17. } from './Functor'
  18. import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT'
  19. /**
  20. * @category model
  21. * @since 2.0.0
  22. */
  23. export interface FunctorWithIndex<F, I> extends Functor<F> {
  24. readonly mapWithIndex: <A, B>(fa: HKT<F, A>, f: (i: I, a: A) => B) => HKT<F, B>
  25. }
  26. /**
  27. * @category model
  28. * @since 2.0.0
  29. */
  30. export interface FunctorWithIndex1<F extends URIS, I> extends Functor1<F> {
  31. readonly mapWithIndex: <A, B>(fa: Kind<F, A>, f: (i: I, a: A) => B) => Kind<F, B>
  32. }
  33. /**
  34. * @category model
  35. * @since 2.0.0
  36. */
  37. export interface FunctorWithIndex2<F extends URIS2, I> extends Functor2<F> {
  38. readonly mapWithIndex: <E, A, B>(fa: Kind2<F, E, A>, f: (i: I, a: A) => B) => Kind2<F, E, B>
  39. }
  40. /**
  41. * @category model
  42. * @since 2.0.0
  43. */
  44. export interface FunctorWithIndex2C<F extends URIS2, I, E> extends Functor2C<F, E> {
  45. readonly mapWithIndex: <A, B>(fa: Kind2<F, E, A>, f: (i: I, a: A) => B) => Kind2<F, E, B>
  46. }
  47. /**
  48. * @category model
  49. * @since 2.0.0
  50. */
  51. export interface FunctorWithIndex3<F extends URIS3, I> extends Functor3<F> {
  52. readonly mapWithIndex: <R, E, A, B>(fa: Kind3<F, R, E, A>, f: (i: I, a: A) => B) => Kind3<F, R, E, B>
  53. }
  54. /**
  55. * @category model
  56. * @since 2.2.0
  57. */
  58. export interface FunctorWithIndex3C<F extends URIS3, I, E> extends Functor3C<F, E> {
  59. readonly mapWithIndex: <R, A, B>(fa: Kind3<F, R, E, A>, f: (i: I, a: A) => B) => Kind3<F, R, E, B>
  60. }
  61. /**
  62. * @category model
  63. * @since 2.0.0
  64. */
  65. export interface FunctorWithIndex4<F extends URIS4, I> extends Functor4<F> {
  66. readonly mapWithIndex: <S, R, E, A, B>(fa: Kind4<F, S, R, E, A>, f: (i: I, a: A) => B) => Kind4<F, S, R, E, B>
  67. }
  68. /**
  69. * `mapWithIndex` composition.
  70. *
  71. * @since 2.10.0
  72. */
  73. export declare function mapWithIndex<F extends URIS, I, G extends URIS, J>(
  74. F: FunctorWithIndex1<F, I>,
  75. G: FunctorWithIndex1<G, J>
  76. ): <A, B>(f: (ij: readonly [I, J], a: A) => B) => (fa: Kind<F, Kind<G, A>>) => Kind<F, Kind<G, B>>
  77. export declare function mapWithIndex<F, I, G, J>(
  78. F: FunctorWithIndex<F, I>,
  79. G: FunctorWithIndex<G, J>
  80. ): <A, B>(f: (ij: readonly [I, J], a: A) => B) => (fa: HKT<F, HKT<G, A>>) => HKT<F, HKT<G, B>>
  81. /**
  82. * @category zone of death
  83. * @since 2.0.0
  84. * @deprecated
  85. */
  86. export interface FunctorWithIndexComposition<F, FI, G, GI> extends FunctorComposition<F, G> {
  87. readonly mapWithIndex: <A, B>(fga: HKT<F, HKT<G, A>>, f: (i: [FI, GI], a: A) => B) => HKT<F, HKT<G, B>>
  88. }
  89. /**
  90. * @category zone of death
  91. * @since 2.0.0
  92. * @deprecated
  93. */
  94. export interface FunctorWithIndexComposition11<F extends URIS, FI, G extends URIS, GI>
  95. extends FunctorComposition11<F, G> {
  96. readonly mapWithIndex: <A, B>(fa: Kind<F, Kind<G, A>>, f: (i: [FI, GI], a: A) => B) => Kind<F, Kind<G, B>>
  97. }
  98. /**
  99. * @category zone of death
  100. * @since 2.0.0
  101. * @deprecated
  102. */
  103. export interface FunctorWithIndexComposition12<F extends URIS, FI, G extends URIS2, GI>
  104. extends FunctorComposition12<F, G> {
  105. readonly mapWithIndex: <E, A, B>(fa: Kind<F, Kind2<G, E, A>>, f: (i: [FI, GI], a: A) => B) => Kind<F, Kind2<G, E, B>>
  106. }
  107. /**
  108. * @category zone of death
  109. * @since 2.0.0
  110. * @deprecated
  111. */
  112. export interface FunctorWithIndexComposition12C<F extends URIS, FI, G extends URIS2, GI, E>
  113. extends FunctorComposition12C<F, G, E> {
  114. readonly mapWithIndex: <A, B>(fa: Kind<F, Kind2<G, E, A>>, f: (i: [FI, GI], a: A) => B) => Kind<F, Kind2<G, E, B>>
  115. }
  116. /**
  117. * @category zone of death
  118. * @since 2.0.0
  119. * @deprecated
  120. */
  121. export interface FunctorWithIndexComposition21<F extends URIS2, FI, G extends URIS, GI>
  122. extends FunctorComposition21<F, G> {
  123. readonly mapWithIndex: <E, A, B>(fa: Kind2<F, E, Kind<G, A>>, f: (i: [FI, GI], a: A) => B) => Kind2<F, E, Kind<G, B>>
  124. }
  125. /**
  126. * @category zone of death
  127. * @since 2.0.0
  128. * @deprecated
  129. */
  130. export interface FunctorWithIndexComposition2C1<F extends URIS2, FI, G extends URIS, GI, E>
  131. extends FunctorComposition2C1<F, G, E> {
  132. readonly mapWithIndex: <A, B>(fa: Kind2<F, E, Kind<G, A>>, f: (i: [FI, GI], a: A) => B) => Kind2<F, E, Kind<G, B>>
  133. }
  134. /**
  135. * @category zone of death
  136. * @since 2.0.0
  137. * @deprecated
  138. */
  139. export interface FunctorWithIndexComposition22<F extends URIS2, FI, G extends URIS2, GI>
  140. extends FunctorComposition22<F, G> {
  141. readonly mapWithIndex: <FE, GE, A, B>(
  142. fa: Kind2<F, FE, Kind2<G, GE, A>>,
  143. f: (i: [FI, GI], a: A) => B
  144. ) => Kind2<F, FE, Kind2<G, GE, B>>
  145. }
  146. /**
  147. * @category zone of death
  148. * @since 2.0.0
  149. * @deprecated
  150. */
  151. export interface FunctorWithIndexComposition22C<F extends URIS2, FI, G extends URIS2, GI, E>
  152. extends FunctorComposition22C<F, G, E> {
  153. readonly mapWithIndex: <FE, A, B>(
  154. fa: Kind2<F, FE, Kind2<G, E, A>>,
  155. f: (i: [FI, GI], a: A) => B
  156. ) => Kind2<F, FE, Kind2<G, E, B>>
  157. }
  158. /**
  159. * Use [`mapWithIndex`](#mapwithindex) instead.
  160. *
  161. * @category zone of death
  162. * @since 2.0.0
  163. * @deprecated
  164. */
  165. export declare function getFunctorWithIndexComposition<F extends URIS2, FI, G extends URIS2, GI, E>(
  166. F: FunctorWithIndex2<F, FI>,
  167. G: FunctorWithIndex2C<G, FI, E>
  168. ): FunctorWithIndexComposition22C<F, FI, G, GI, E>
  169. /** @deprecated */
  170. export declare function getFunctorWithIndexComposition<F extends URIS2, FI, G extends URIS2, GI>(
  171. F: FunctorWithIndex2<F, FI>,
  172. G: FunctorWithIndex2<G, FI>
  173. ): FunctorWithIndexComposition22<F, FI, G, GI>
  174. /** @deprecated */
  175. export declare function getFunctorWithIndexComposition<F extends URIS2, FI, G extends URIS, GI, E>(
  176. F: FunctorWithIndex2C<F, FI, E>,
  177. G: FunctorWithIndex1<G, GI>
  178. ): FunctorWithIndexComposition2C1<F, FI, G, GI, E>
  179. /** @deprecated */
  180. export declare function getFunctorWithIndexComposition<F extends URIS2, FI, G extends URIS, GI>(
  181. F: FunctorWithIndex2<F, FI>,
  182. G: FunctorWithIndex1<G, GI>
  183. ): FunctorWithIndexComposition21<F, FI, G, GI>
  184. /** @deprecated */
  185. export declare function getFunctorWithIndexComposition<F extends URIS, FI, G extends URIS2, GI, E>(
  186. F: FunctorWithIndex1<F, FI>,
  187. G: FunctorWithIndex2C<G, GI, E>
  188. ): FunctorWithIndexComposition12C<F, FI, G, GI, E>
  189. /** @deprecated */
  190. export declare function getFunctorWithIndexComposition<F extends URIS, FI, G extends URIS2, GI>(
  191. F: FunctorWithIndex1<F, FI>,
  192. G: FunctorWithIndex2<G, GI>
  193. ): FunctorWithIndexComposition12<F, FI, G, GI>
  194. /** @deprecated */
  195. export declare function getFunctorWithIndexComposition<F extends URIS, FI, G extends URIS, GI>(
  196. F: FunctorWithIndex1<F, FI>,
  197. G: FunctorWithIndex1<G, GI>
  198. ): FunctorWithIndexComposition11<F, FI, G, GI>
  199. /** @deprecated */
  200. export declare function getFunctorWithIndexComposition<F, FI, G, GI>(
  201. F: FunctorWithIndex<F, FI>,
  202. G: FunctorWithIndex<G, GI>
  203. ): FunctorWithIndexComposition<F, FI, G, GI>