版博士V2.0程序
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

264 righe
6.5 KiB

  1. /**
  2. * @since 2.0.0
  3. */
  4. import { Alt1 } from './Alt'
  5. import { Applicative1 } from './Applicative'
  6. import { Apply1 } from './Apply'
  7. import { Chain1 } from './Chain'
  8. import { ChainRec1 } from './ChainRec'
  9. import { Comonad1 } from './Comonad'
  10. import { Eq } from './Eq'
  11. import { Foldable1 } from './Foldable'
  12. import { Functor1 } from './Functor'
  13. import { Monad1 } from './Monad'
  14. import { Monoid } from './Monoid'
  15. import { Pointed1 } from './Pointed'
  16. import { Show } from './Show'
  17. import { PipeableTraverse1, Traversable1 } from './Traversable'
  18. /**
  19. * @category model
  20. * @since 2.0.0
  21. */
  22. export declare type Identity<A> = A
  23. /**
  24. * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
  25. * use the type constructor `F` to represent some computational context.
  26. *
  27. * @category mapping
  28. * @since 2.0.0
  29. */
  30. export declare const map: <A, B>(f: (a: A) => B) => (fa: Identity<A>) => Identity<B>
  31. /**
  32. * @since 2.0.0
  33. */
  34. export declare const ap: <A>(fa: Identity<A>) => <B>(fab: Identity<(a: A) => B>) => Identity<B>
  35. /**
  36. * @category constructors
  37. * @since 2.0.0
  38. */
  39. export declare const of: <A>(a: A) => Identity<A>
  40. /**
  41. * Composes computations in sequence, using the return value of one computation to determine the next computation.
  42. *
  43. * @category sequencing
  44. * @since 2.0.0
  45. */
  46. export declare const chain: <A, B>(f: (a: A) => Identity<B>) => (ma: Identity<A>) => Identity<B>
  47. /**
  48. * @since 2.0.0
  49. */
  50. export declare const extend: <A, B>(f: (wa: Identity<A>) => B) => (wa: Identity<A>) => Identity<B>
  51. /**
  52. * @category Extract
  53. * @since 2.6.2
  54. */
  55. export declare const extract: <A>(wa: Identity<A>) => A
  56. /**
  57. * @since 2.0.0
  58. */
  59. export declare const duplicate: <A>(ma: Identity<A>) => Identity<Identity<A>>
  60. /**
  61. * @category sequencing
  62. * @since 2.0.0
  63. */
  64. export declare const flatten: <A>(mma: Identity<Identity<A>>) => Identity<A>
  65. /**
  66. * @category folding
  67. * @since 2.0.0
  68. */
  69. export declare const reduce: <A, B>(b: B, f: (b: B, a: A) => B) => (fa: Identity<A>) => B
  70. /**
  71. * @category folding
  72. * @since 2.0.0
  73. */
  74. export declare const foldMap: <M>(M: Monoid<M>) => <A>(f: (a: A) => M) => (fa: Identity<A>) => M
  75. /**
  76. * @category folding
  77. * @since 2.0.0
  78. */
  79. export declare const reduceRight: <A, B>(b: B, f: (a: A, b: B) => B) => (fa: Identity<A>) => B
  80. /**
  81. * @category traversing
  82. * @since 2.6.3
  83. */
  84. export declare const traverse: PipeableTraverse1<URI>
  85. /**
  86. * @category traversing
  87. * @since 2.6.3
  88. */
  89. export declare const sequence: Traversable1<URI>['sequence']
  90. /**
  91. * Less strict version of [`alt`](#alt).
  92. *
  93. * The `W` suffix (short for **W**idening) means that the return types will be merged.
  94. *
  95. * @category error handling
  96. * @since 2.9.0
  97. */
  98. export declare const altW: <B>(that: () => Identity<B>) => <A>(fa: Identity<A>) => Identity<A | B>
  99. /**
  100. * Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to
  101. * types of kind `* -> *`.
  102. *
  103. * @category error handling
  104. * @since 2.0.0
  105. */
  106. export declare const alt: <A>(that: () => Identity<A>) => (fa: Identity<A>) => Identity<A>
  107. /**
  108. * @category type lambdas
  109. * @since 2.0.0
  110. */
  111. export declare const URI = 'Identity'
  112. /**
  113. * @category type lambdas
  114. * @since 2.0.0
  115. */
  116. export declare type URI = typeof URI
  117. declare module './HKT' {
  118. interface URItoKind<A> {
  119. readonly [URI]: Identity<A>
  120. }
  121. }
  122. /**
  123. * @category instances
  124. * @since 2.0.0
  125. */
  126. export declare const getShow: <A>(S: Show<A>) => Show<Identity<A>>
  127. /**
  128. * @category instances
  129. * @since 2.0.0
  130. */
  131. export declare const getEq: <A>(E: Eq<A>) => Eq<Identity<A>>
  132. /**
  133. * @category instances
  134. * @since 2.7.0
  135. */
  136. export declare const Functor: Functor1<URI>
  137. /**
  138. * @category mapping
  139. * @since 2.10.0
  140. */
  141. export declare const flap: <A>(a: A) => <B>(fab: (a: A) => B) => B
  142. /**
  143. * @category instances
  144. * @since 2.10.0
  145. */
  146. export declare const Pointed: Pointed1<URI>
  147. /**
  148. * @category instances
  149. * @since 2.10.0
  150. */
  151. export declare const Apply: Apply1<URI>
  152. /**
  153. * Combine two effectful actions, keeping only the result of the first.
  154. *
  155. * @since 2.0.0
  156. */
  157. export declare const apFirst: <B>(second: B) => <A>(first: A) => A
  158. /**
  159. * Combine two effectful actions, keeping only the result of the second.
  160. *
  161. * @since 2.0.0
  162. */
  163. export declare const apSecond: <B>(second: B) => <A>(first: A) => B
  164. /**
  165. * @category instances
  166. * @since 2.7.0
  167. */
  168. export declare const Applicative: Applicative1<URI>
  169. /**
  170. * @category instances
  171. * @since 2.10.0
  172. */
  173. export declare const Chain: Chain1<URI>
  174. /**
  175. * @category instances
  176. * @since 2.7.0
  177. */
  178. export declare const Monad: Monad1<URI>
  179. /**
  180. * Composes computations in sequence, using the return value of one computation to determine the next computation and
  181. * keeping only the result of the first.
  182. *
  183. * @category sequencing
  184. * @since 2.0.0
  185. */
  186. export declare const chainFirst: <A, B>(f: (a: A) => B) => (first: A) => A
  187. /**
  188. * @category instances
  189. * @since 2.7.0
  190. */
  191. export declare const Foldable: Foldable1<URI>
  192. /**
  193. * @category instances
  194. * @since 2.7.0
  195. */
  196. export declare const Traversable: Traversable1<URI>
  197. /**
  198. * @category instances
  199. * @since 2.7.0
  200. */
  201. export declare const Alt: Alt1<URI>
  202. /**
  203. * @category instances
  204. * @since 2.7.0
  205. */
  206. export declare const Comonad: Comonad1<URI>
  207. /**
  208. * @category instances
  209. * @since 2.7.0
  210. */
  211. export declare const ChainRec: ChainRec1<URI>
  212. /**
  213. * @category do notation
  214. * @since 2.9.0
  215. */
  216. export declare const Do: Identity<{}>
  217. /**
  218. * @category do notation
  219. * @since 2.8.0
  220. */
  221. export declare const bindTo: <N extends string>(name: N) => <A>(fa: A) => { readonly [K in N]: A }
  222. declare const let_: <N extends string, A, B>(
  223. name: Exclude<N, keyof A>,
  224. f: (a: A) => B
  225. ) => (fa: A) => { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }
  226. export {
  227. /**
  228. * @category do notation
  229. * @since 2.13.0
  230. */
  231. let_ as let
  232. }
  233. /**
  234. * @category do notation
  235. * @since 2.8.0
  236. */
  237. export declare const bind: <N extends string, A, B>(
  238. name: Exclude<N, keyof A>,
  239. f: (a: A) => B
  240. ) => (ma: A) => { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }
  241. /**
  242. * @category do notation
  243. * @since 2.8.0
  244. */
  245. export declare const apS: <N extends string, A, B>(
  246. name: Exclude<N, keyof A>,
  247. fb: B
  248. ) => (fa: A) => { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }
  249. /**
  250. * This instance is deprecated, use small, specific instances instead.
  251. * For example if a function needs a `Functor` instance, pass `I.Functor` instead of `I.identity`
  252. * (where `I` is from `import I from 'fp-ts/Identity'`)
  253. *
  254. * @category zone of death
  255. * @since 2.0.0
  256. * @deprecated
  257. */
  258. export declare const identity: Monad1<URI> &
  259. Foldable1<URI> &
  260. Traversable1<URI> &
  261. Alt1<URI> &
  262. Comonad1<URI> &
  263. ChainRec1<URI>