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

1 год назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. /**
  2. * @since 2.0.0
  3. */
  4. import { Either } from './Either'
  5. import { Eq } from './Eq'
  6. import { Magma } from './Magma'
  7. import { Monoid } from './Monoid'
  8. import { Option } from './Option'
  9. import { Ord } from './Ord'
  10. import { Predicate } from './Predicate'
  11. import { Refinement } from './Refinement'
  12. import { Semigroup } from './Semigroup'
  13. import { Separated } from './Separated'
  14. import { Show } from './Show'
  15. /**
  16. * @category instances
  17. * @since 2.0.0
  18. */
  19. export declare const getShow: <A>(S: Show<A>) => Show<Set<A>>
  20. /**
  21. * @category instances
  22. * @since 2.0.0
  23. */
  24. export declare const getEq: <A>(E: Eq<A>) => Eq<Set<A>>
  25. /**
  26. * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
  27. * use the type constructor `F` to represent some computational context.
  28. *
  29. * @since 2.0.0
  30. */
  31. export declare function map<B>(E: Eq<B>): <A>(f: (x: A) => B) => (set: Set<A>) => Set<B>
  32. /**
  33. * Composes computations in sequence, using the return value of one computation to determine the next computation.
  34. *
  35. * @since 2.0.0
  36. */
  37. export declare function chain<B>(E: Eq<B>): <A>(f: (x: A) => Set<B>) => (set: Set<A>) => Set<B>
  38. /**
  39. * @since 2.0.0
  40. */
  41. export declare function filter<A, B extends A>(refinement: Refinement<A, B>): (set: Set<A>) => Set<B>
  42. export declare function filter<A>(predicate: Predicate<A>): <B extends A>(set: Set<B>) => Set<B>
  43. export declare function filter<A>(predicate: Predicate<A>): (set: Set<A>) => Set<A>
  44. /**
  45. * @since 2.0.0
  46. */
  47. export declare function partition<A, B extends A>(
  48. refinement: Refinement<A, B>
  49. ): (set: Set<A>) => Separated<Set<A>, Set<B>>
  50. export declare function partition<A>(predicate: Predicate<A>): <B extends A>(set: Set<B>) => Separated<Set<B>, Set<B>>
  51. export declare function partition<A>(predicate: Predicate<A>): (set: Set<A>) => Separated<Set<A>, Set<A>>
  52. /**
  53. * Form the union of two sets
  54. *
  55. * @since 2.0.0
  56. */
  57. export declare function union<A>(E: Eq<A>): {
  58. (that: Set<A>): (me: Set<A>) => Set<A>
  59. (me: Set<A>, that: Set<A>): Set<A>
  60. }
  61. /**
  62. * The set of elements which are in both the first and second set
  63. *
  64. * @since 2.0.0
  65. */
  66. export declare function intersection<A>(E: Eq<A>): {
  67. (that: Set<A>): (me: Set<A>) => Set<A>
  68. (me: Set<A>, that: Set<A>): Set<A>
  69. }
  70. /**
  71. * @since 2.0.0
  72. */
  73. export declare function partitionMap<B, C>(
  74. EB: Eq<B>,
  75. EC: Eq<C>
  76. ): <A>(f: (a: A) => Either<B, C>) => (set: Set<A>) => Separated<Set<B>, Set<C>>
  77. /**
  78. * Form the set difference (`x` - `y`)
  79. *
  80. * @example
  81. * import { difference } from 'fp-ts/Set'
  82. * import * as N from 'fp-ts/number'
  83. * import { pipe } from 'fp-ts/function'
  84. *
  85. * assert.deepStrictEqual(pipe(new Set([1, 2]), difference(N.Eq)(new Set([1, 3]))), new Set([2]))
  86. *
  87. * @since 2.0.0
  88. */
  89. export declare function difference<A>(E: Eq<A>): {
  90. (that: Set<A>): (me: Set<A>) => Set<A>
  91. (me: Set<A>, that: Set<A>): Set<A>
  92. }
  93. /**
  94. * @category instances
  95. * @since 2.11.0
  96. */
  97. export declare const getUnionSemigroup: <A>(E: Eq<A>) => Semigroup<Set<A>>
  98. /**
  99. * @category instances
  100. * @since 2.0.0
  101. */
  102. export declare const getUnionMonoid: <A>(E: Eq<A>) => Monoid<Set<A>>
  103. /**
  104. * @category instances
  105. * @since 2.0.0
  106. */
  107. export declare const getIntersectionSemigroup: <A>(E: Eq<A>) => Semigroup<Set<A>>
  108. /**
  109. * @category instances
  110. * @since 2.11.0
  111. */
  112. export declare const getDifferenceMagma: <A>(E: Eq<A>) => Magma<Set<A>>
  113. /**
  114. * @category folding
  115. * @since 2.0.0
  116. */
  117. export declare const reduce: <A>(O: Ord<A>) => <B>(b: B, f: (b: B, a: A) => B) => (fa: Set<A>) => B
  118. /**
  119. * @category folding
  120. * @since 2.0.0
  121. */
  122. export declare const foldMap: <A, M>(O: Ord<A>, M: Monoid<M>) => (f: (a: A) => M) => (fa: Set<A>) => M
  123. /**
  124. * @category folding
  125. * @since 2.11.0
  126. */
  127. export declare const reduceRight: <A>(O: Ord<A>) => <B>(b: B, f: (a: A, b: B) => B) => (fa: Set<A>) => B
  128. /**
  129. * Create a set with one element
  130. *
  131. * @category constructors
  132. * @since 2.0.0
  133. */
  134. export declare const singleton: <A>(a: A) => Set<A>
  135. /**
  136. * Insert a value into a set
  137. *
  138. * @since 2.0.0
  139. */
  140. export declare function insert<A>(E: Eq<A>): (a: A) => (set: Set<A>) => Set<A>
  141. /**
  142. * Delete a value from a set
  143. *
  144. * @since 2.0.0
  145. */
  146. export declare const remove: <A>(E: Eq<A>) => (a: A) => (set: Set<A>) => Set<A>
  147. /**
  148. * Checks an element is a member of a set;
  149. * If yes, removes the value from the set
  150. * If no, inserts the value to the set
  151. *
  152. * @since 2.5.0
  153. */
  154. export declare const toggle: <A>(E: Eq<A>) => (a: A) => (set: Set<A>) => Set<A>
  155. /**
  156. * Create a set from an array
  157. *
  158. * @category conversions
  159. * @since 2.0.0
  160. */
  161. export declare const fromArray: <A>(E: Eq<A>) => (as: A[]) => Set<A>
  162. /**
  163. * @since 2.0.0
  164. */
  165. export declare const compact: <A>(E: Eq<A>) => (fa: Set<Option<A>>) => Set<A>
  166. /**
  167. * @since 2.0.0
  168. */
  169. export declare function separate<E, A>(EE: Eq<E>, EA: Eq<A>): (fa: Set<Either<E, A>>) => Separated<Set<E>, Set<A>>
  170. /**
  171. * @since 2.0.0
  172. */
  173. export declare function filterMap<B>(E: Eq<B>): <A>(f: (a: A) => Option<B>) => (fa: Set<A>) => Set<B>
  174. /**
  175. * @since 2.0.0
  176. */
  177. export declare const empty: Set<never>
  178. /**
  179. * Test whether a `Set` is empty.
  180. *
  181. * @since 2.10.0
  182. */
  183. export declare const isEmpty: <A>(set: Set<A>) => boolean
  184. /**
  185. * Calculate the number of elements in a `Set`.
  186. *
  187. * @since 2.10.0
  188. */
  189. export declare const size: <A>(set: Set<A>) => number
  190. /**
  191. * @since 2.0.0
  192. */
  193. export declare const some: <A>(predicate: Predicate<A>) => (set: Set<A>) => boolean
  194. /**
  195. * @since 2.0.0
  196. */
  197. export declare const every: {
  198. <A, B extends A>(refinement: Refinement<A, B>): Refinement<Set<A>, Set<B>>
  199. <A>(predicate: Predicate<A>): Predicate<Set<A>>
  200. }
  201. /**
  202. * @since 2.10.0
  203. */
  204. export declare const isSubset: <A>(E: Eq<A>) => (that: Set<A>) => (me: Set<A>) => boolean
  205. /**
  206. * Test if a value is a member of a set
  207. *
  208. * @since 2.0.0
  209. */
  210. export declare const elem: <A>(E: Eq<A>) => {
  211. (a: A): (set: Set<A>) => boolean
  212. (a: A, set: Set<A>): boolean
  213. }
  214. /**
  215. * Get a sorted `Array` of the values contained in a `Set`.
  216. *
  217. * @category conversions
  218. * @since 2.0.0
  219. */
  220. export declare const toArray: <A>(O: Ord<A>) => (set: Set<A>) => A[]
  221. /**
  222. * Use [`isSubset`](#issubset) instead.
  223. *
  224. * @category zone of death
  225. * @since 2.0.0
  226. * @deprecated
  227. */
  228. export declare const subset: <A>(E: Eq<A>) => {
  229. (that: Set<A>): (me: Set<A>) => boolean
  230. (me: Set<A>, that: Set<A>): boolean
  231. }