effect 3.8.4 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (757) hide show
  1. package/dist/cjs/Array.js +24 -3
  2. package/dist/cjs/Array.js.map +1 -1
  3. package/dist/cjs/BigDecimal.js +5 -3
  4. package/dist/cjs/BigDecimal.js.map +1 -1
  5. package/dist/cjs/BigInt.js.map +1 -1
  6. package/dist/cjs/Boolean.js.map +1 -1
  7. package/dist/cjs/Cause.js.map +1 -1
  8. package/dist/cjs/Channel.js.map +1 -1
  9. package/dist/cjs/ChildExecutorDecision.js.map +1 -1
  10. package/dist/cjs/Chunk.js +3 -0
  11. package/dist/cjs/Chunk.js.map +1 -1
  12. package/dist/cjs/Config.js.map +1 -1
  13. package/dist/cjs/ConfigError.js.map +1 -1
  14. package/dist/cjs/ConfigProvider.js.map +1 -1
  15. package/dist/cjs/ConfigProviderPathPatch.js.map +1 -1
  16. package/dist/cjs/Console.js.map +1 -1
  17. package/dist/cjs/Context.js.map +1 -1
  18. package/dist/cjs/Cron.js +3 -0
  19. package/dist/cjs/Cron.js.map +1 -1
  20. package/dist/cjs/Data.js.map +1 -1
  21. package/dist/cjs/DateTime.js +6 -0
  22. package/dist/cjs/DateTime.js.map +1 -1
  23. package/dist/cjs/Deferred.js.map +1 -1
  24. package/dist/cjs/Differ.js.map +1 -1
  25. package/dist/cjs/Duration.js +3 -0
  26. package/dist/cjs/Duration.js.map +1 -1
  27. package/dist/cjs/Effect.js +122 -35
  28. package/dist/cjs/Effect.js.map +1 -1
  29. package/dist/cjs/Either.js.map +1 -1
  30. package/dist/cjs/Equivalence.js.map +1 -1
  31. package/dist/cjs/ExecutionStrategy.js.map +1 -1
  32. package/dist/cjs/Exit.js.map +1 -1
  33. package/dist/cjs/Fiber.js.map +1 -1
  34. package/dist/cjs/FiberHandle.js +3 -0
  35. package/dist/cjs/FiberHandle.js.map +1 -1
  36. package/dist/cjs/FiberId.js.map +1 -1
  37. package/dist/cjs/FiberMap.js +3 -0
  38. package/dist/cjs/FiberMap.js.map +1 -1
  39. package/dist/cjs/FiberRef.js.map +1 -1
  40. package/dist/cjs/FiberRefs.js.map +1 -1
  41. package/dist/cjs/FiberRefsPatch.js.map +1 -1
  42. package/dist/cjs/FiberSet.js +3 -0
  43. package/dist/cjs/FiberSet.js.map +1 -1
  44. package/dist/cjs/Function.js.map +1 -1
  45. package/dist/cjs/GroupBy.js.map +1 -1
  46. package/dist/cjs/Hash.js.map +1 -1
  47. package/dist/cjs/HashMap.js.map +1 -1
  48. package/dist/cjs/HashSet.js.map +1 -1
  49. package/dist/cjs/Inspectable.js +15 -1
  50. package/dist/cjs/Inspectable.js.map +1 -1
  51. package/dist/cjs/Iterable.js.map +1 -1
  52. package/dist/cjs/KeyedPool.js.map +1 -1
  53. package/dist/cjs/Layer.js.map +1 -1
  54. package/dist/cjs/List.js +6 -0
  55. package/dist/cjs/List.js.map +1 -1
  56. package/dist/cjs/LogLevel.js.map +1 -1
  57. package/dist/cjs/Logger.js.map +1 -1
  58. package/dist/cjs/Mailbox.js.map +1 -1
  59. package/dist/cjs/ManagedRuntime.js +16 -1
  60. package/dist/cjs/ManagedRuntime.js.map +1 -1
  61. package/dist/cjs/MergeDecision.js.map +1 -1
  62. package/dist/cjs/MergeState.js.map +1 -1
  63. package/dist/cjs/MergeStrategy.js.map +1 -1
  64. package/dist/cjs/Metric.js.map +1 -1
  65. package/dist/cjs/MetricHook.js.map +1 -1
  66. package/dist/cjs/MetricKey.js.map +1 -1
  67. package/dist/cjs/MetricPolling.js.map +1 -1
  68. package/dist/cjs/MetricState.js.map +1 -1
  69. package/dist/cjs/Micro.js +6 -0
  70. package/dist/cjs/Micro.js.map +1 -1
  71. package/dist/cjs/MutableHashMap.js +3 -0
  72. package/dist/cjs/MutableHashMap.js.map +1 -1
  73. package/dist/cjs/MutableHashSet.js +3 -0
  74. package/dist/cjs/MutableHashSet.js.map +1 -1
  75. package/dist/cjs/MutableList.js +3 -0
  76. package/dist/cjs/MutableList.js.map +1 -1
  77. package/dist/cjs/MutableQueue.js +3 -0
  78. package/dist/cjs/MutableQueue.js.map +1 -1
  79. package/dist/cjs/MutableRef.js +3 -0
  80. package/dist/cjs/MutableRef.js.map +1 -1
  81. package/dist/cjs/Number.js.map +1 -1
  82. package/dist/cjs/Option.js.map +1 -1
  83. package/dist/cjs/Order.js.map +1 -1
  84. package/dist/cjs/Ordering.js.map +1 -1
  85. package/dist/cjs/Pipeable.js.map +1 -1
  86. package/dist/cjs/Pool.js.map +1 -1
  87. package/dist/cjs/Predicate.js +18 -2
  88. package/dist/cjs/Predicate.js.map +1 -1
  89. package/dist/cjs/PubSub.js.map +1 -1
  90. package/dist/cjs/Queue.js.map +1 -1
  91. package/dist/cjs/RcMap.js.map +1 -1
  92. package/dist/cjs/Readable.js.map +1 -1
  93. package/dist/cjs/Record.js.map +1 -1
  94. package/dist/cjs/RedBlackTree.js.map +1 -1
  95. package/dist/cjs/Ref.js.map +1 -1
  96. package/dist/cjs/RegExp.js +20 -1
  97. package/dist/cjs/RegExp.js.map +1 -1
  98. package/dist/cjs/Request.js.map +1 -1
  99. package/dist/cjs/RequestResolver.js.map +1 -1
  100. package/dist/cjs/Resource.js.map +1 -1
  101. package/dist/cjs/Runtime.js.map +1 -1
  102. package/dist/cjs/RuntimeFlags.js.map +1 -1
  103. package/dist/cjs/RuntimeFlagsPatch.js.map +1 -1
  104. package/dist/cjs/STM.js.map +1 -1
  105. package/dist/cjs/Schedule.js.map +1 -1
  106. package/dist/cjs/ScheduleInterval.js.map +1 -1
  107. package/dist/cjs/ScheduleIntervals.js.map +1 -1
  108. package/dist/cjs/Scheduler.js.map +1 -1
  109. package/dist/cjs/Scope.js.map +1 -1
  110. package/dist/cjs/ScopedRef.js.map +1 -1
  111. package/dist/cjs/Sink.js.map +1 -1
  112. package/dist/cjs/SortedMap.js +3 -0
  113. package/dist/cjs/SortedMap.js.map +1 -1
  114. package/dist/cjs/SortedSet.js +3 -0
  115. package/dist/cjs/SortedSet.js.map +1 -1
  116. package/dist/cjs/Stream.js +17 -3
  117. package/dist/cjs/Stream.js.map +1 -1
  118. package/dist/cjs/StreamHaltStrategy.js.map +1 -1
  119. package/dist/cjs/String.js.map +1 -1
  120. package/dist/cjs/Struct.js.map +1 -1
  121. package/dist/cjs/Subscribable.js.map +1 -1
  122. package/dist/cjs/SubscriptionRef.js.map +1 -1
  123. package/dist/cjs/SynchronizedRef.js.map +1 -1
  124. package/dist/cjs/TArray.js.map +1 -1
  125. package/dist/cjs/TDeferred.js.map +1 -1
  126. package/dist/cjs/TMap.js.map +1 -1
  127. package/dist/cjs/TPriorityQueue.js.map +1 -1
  128. package/dist/cjs/TPubSub.js.map +1 -1
  129. package/dist/cjs/TQueue.js.map +1 -1
  130. package/dist/cjs/TReentrantLock.js.map +1 -1
  131. package/dist/cjs/TRef.js.map +1 -1
  132. package/dist/cjs/TSemaphore.js.map +1 -1
  133. package/dist/cjs/TSet.js.map +1 -1
  134. package/dist/cjs/Take.js.map +1 -1
  135. package/dist/cjs/TestAnnotationMap.js.map +1 -1
  136. package/dist/cjs/TestClock.js.map +1 -1
  137. package/dist/cjs/TestServices.js.map +1 -1
  138. package/dist/cjs/Trie.js.map +1 -1
  139. package/dist/cjs/Tuple.js +21 -2
  140. package/dist/cjs/Tuple.js.map +1 -1
  141. package/dist/cjs/Unify.js.map +1 -1
  142. package/dist/cjs/UpstreamPullRequest.js.map +1 -1
  143. package/dist/cjs/UpstreamPullStrategy.js.map +1 -1
  144. package/dist/cjs/Utils.js +1 -14
  145. package/dist/cjs/Utils.js.map +1 -1
  146. package/dist/cjs/internal/cause.js +3 -0
  147. package/dist/cjs/internal/cause.js.map +1 -1
  148. package/dist/cjs/internal/context.js +6 -1
  149. package/dist/cjs/internal/context.js.map +1 -1
  150. package/dist/cjs/internal/core-effect.js.map +1 -1
  151. package/dist/cjs/internal/core.js +16 -3
  152. package/dist/cjs/internal/core.js.map +1 -1
  153. package/dist/cjs/internal/effect/circular.js +5 -1
  154. package/dist/cjs/internal/effect/circular.js.map +1 -1
  155. package/dist/cjs/internal/fiberId.js +9 -0
  156. package/dist/cjs/internal/fiberId.js.map +1 -1
  157. package/dist/cjs/internal/hashMap.js +3 -0
  158. package/dist/cjs/internal/hashMap.js.map +1 -1
  159. package/dist/cjs/internal/hashSet.js +3 -0
  160. package/dist/cjs/internal/hashSet.js.map +1 -1
  161. package/dist/cjs/internal/layer.js +33 -19
  162. package/dist/cjs/internal/layer.js.map +1 -1
  163. package/dist/cjs/internal/mailbox.js +3 -0
  164. package/dist/cjs/internal/mailbox.js.map +1 -1
  165. package/dist/cjs/internal/managedRuntime/circular.js +10 -0
  166. package/dist/cjs/internal/managedRuntime/circular.js.map +1 -0
  167. package/dist/cjs/internal/managedRuntime.js +23 -9
  168. package/dist/cjs/internal/managedRuntime.js.map +1 -1
  169. package/dist/cjs/internal/option.js +3 -0
  170. package/dist/cjs/internal/option.js.map +1 -1
  171. package/dist/cjs/internal/pool.js +6 -1
  172. package/dist/cjs/internal/pool.js.map +1 -1
  173. package/dist/cjs/internal/redBlackTree.js +3 -0
  174. package/dist/cjs/internal/redBlackTree.js.map +1 -1
  175. package/dist/cjs/internal/resource.js +15 -5
  176. package/dist/cjs/internal/resource.js.map +1 -1
  177. package/dist/cjs/internal/runtime.js +4 -1
  178. package/dist/cjs/internal/runtime.js.map +1 -1
  179. package/dist/cjs/internal/scopedRef.js +11 -8
  180. package/dist/cjs/internal/scopedRef.js.map +1 -1
  181. package/dist/cjs/internal/stm/core.js +1 -2
  182. package/dist/cjs/internal/stm/core.js.map +1 -1
  183. package/dist/cjs/internal/stream.js +12 -3
  184. package/dist/cjs/internal/stream.js.map +1 -1
  185. package/dist/cjs/internal/trie.js +3 -0
  186. package/dist/cjs/internal/trie.js.map +1 -1
  187. package/dist/cjs/internal/version.js +1 -1
  188. package/dist/dts/Array.d.ts +2735 -2
  189. package/dist/dts/Array.d.ts.map +1 -1
  190. package/dist/dts/BigDecimal.d.ts +558 -1
  191. package/dist/dts/BigDecimal.d.ts.map +1 -1
  192. package/dist/dts/BigInt.d.ts +490 -0
  193. package/dist/dts/BigInt.d.ts.map +1 -1
  194. package/dist/dts/Boolean.d.ts +228 -0
  195. package/dist/dts/Boolean.d.ts.map +1 -1
  196. package/dist/dts/Cause.d.ts +172 -0
  197. package/dist/dts/Cause.d.ts.map +1 -1
  198. package/dist/dts/Channel.d.ts +750 -0
  199. package/dist/dts/Channel.d.ts.map +1 -1
  200. package/dist/dts/ChildExecutorDecision.d.ts +12 -0
  201. package/dist/dts/ChildExecutorDecision.d.ts.map +1 -1
  202. package/dist/dts/Chunk.d.ts +791 -0
  203. package/dist/dts/Chunk.d.ts.map +1 -1
  204. package/dist/dts/Config.d.ts +174 -0
  205. package/dist/dts/Config.d.ts.map +1 -1
  206. package/dist/dts/ConfigError.d.ts +16 -0
  207. package/dist/dts/ConfigError.d.ts.map +1 -1
  208. package/dist/dts/ConfigProvider.d.ts +84 -0
  209. package/dist/dts/ConfigProvider.d.ts.map +1 -1
  210. package/dist/dts/ConfigProviderPathPatch.d.ts +32 -0
  211. package/dist/dts/ConfigProviderPathPatch.d.ts.map +1 -1
  212. package/dist/dts/Console.d.ts +24 -0
  213. package/dist/dts/Console.d.ts.map +1 -1
  214. package/dist/dts/Context.d.ts +234 -3
  215. package/dist/dts/Context.d.ts.map +1 -1
  216. package/dist/dts/Cron.d.ts +12 -0
  217. package/dist/dts/Cron.d.ts.map +1 -1
  218. package/dist/dts/Data.d.ts +165 -0
  219. package/dist/dts/Data.d.ts.map +1 -1
  220. package/dist/dts/DateTime.d.ts +878 -0
  221. package/dist/dts/DateTime.d.ts.map +1 -1
  222. package/dist/dts/Deferred.d.ts +171 -1
  223. package/dist/dts/Deferred.d.ts.map +1 -1
  224. package/dist/dts/Differ.d.ts +78 -0
  225. package/dist/dts/Differ.d.ts.map +1 -1
  226. package/dist/dts/Duration.d.ts +130 -0
  227. package/dist/dts/Duration.d.ts.map +1 -1
  228. package/dist/dts/Effect.d.ts +4350 -13
  229. package/dist/dts/Effect.d.ts.map +1 -1
  230. package/dist/dts/Either.d.ts +620 -0
  231. package/dist/dts/Either.d.ts.map +1 -1
  232. package/dist/dts/Equivalence.d.ts +24 -0
  233. package/dist/dts/Equivalence.d.ts.map +1 -1
  234. package/dist/dts/ExecutionStrategy.d.ts +14 -0
  235. package/dist/dts/ExecutionStrategy.d.ts.map +1 -1
  236. package/dist/dts/Exit.d.ts +252 -0
  237. package/dist/dts/Exit.d.ts.map +1 -1
  238. package/dist/dts/Fiber.d.ts +182 -0
  239. package/dist/dts/Fiber.d.ts.map +1 -1
  240. package/dist/dts/FiberHandle.d.ts +42 -0
  241. package/dist/dts/FiberHandle.d.ts.map +1 -1
  242. package/dist/dts/FiberId.d.ts +24 -0
  243. package/dist/dts/FiberId.d.ts.map +1 -1
  244. package/dist/dts/FiberMap.d.ts +102 -0
  245. package/dist/dts/FiberMap.d.ts.map +1 -1
  246. package/dist/dts/FiberRef.d.ts +80 -0
  247. package/dist/dts/FiberRef.d.ts.map +1 -1
  248. package/dist/dts/FiberRefs.d.ts +84 -0
  249. package/dist/dts/FiberRefs.d.ts.map +1 -1
  250. package/dist/dts/FiberRefsPatch.d.ts +30 -0
  251. package/dist/dts/FiberRefsPatch.d.ts.map +1 -1
  252. package/dist/dts/FiberSet.d.ts +38 -0
  253. package/dist/dts/FiberSet.d.ts.map +1 -1
  254. package/dist/dts/Function.d.ts +144 -28
  255. package/dist/dts/Function.d.ts.map +1 -1
  256. package/dist/dts/GroupBy.d.ts +38 -0
  257. package/dist/dts/GroupBy.d.ts.map +1 -1
  258. package/dist/dts/Hash.d.ts +8 -0
  259. package/dist/dts/Hash.d.ts.map +1 -1
  260. package/dist/dts/HashMap.d.ts +315 -0
  261. package/dist/dts/HashMap.d.ts.map +1 -1
  262. package/dist/dts/HashSet.d.ts +284 -0
  263. package/dist/dts/HashSet.d.ts.map +1 -1
  264. package/dist/dts/Inspectable.d.ts +15 -0
  265. package/dist/dts/Inspectable.d.ts.map +1 -1
  266. package/dist/dts/Iterable.d.ts +454 -0
  267. package/dist/dts/Iterable.d.ts.map +1 -1
  268. package/dist/dts/KeyedPool.d.ts +34 -0
  269. package/dist/dts/KeyedPool.d.ts.map +1 -1
  270. package/dist/dts/Layer.d.ts +460 -5
  271. package/dist/dts/Layer.d.ts.map +1 -1
  272. package/dist/dts/List.d.ts +430 -0
  273. package/dist/dts/List.d.ts.map +1 -1
  274. package/dist/dts/LogLevel.d.ts +46 -0
  275. package/dist/dts/LogLevel.d.ts.map +1 -1
  276. package/dist/dts/Logger.d.ts +194 -0
  277. package/dist/dts/Logger.d.ts.map +1 -1
  278. package/dist/dts/Mailbox.d.ts +16 -0
  279. package/dist/dts/Mailbox.d.ts.map +1 -1
  280. package/dist/dts/ManagedRuntime.d.ts +41 -2
  281. package/dist/dts/ManagedRuntime.d.ts.map +1 -1
  282. package/dist/dts/MergeDecision.d.ts +8 -0
  283. package/dist/dts/MergeDecision.d.ts.map +1 -1
  284. package/dist/dts/MergeState.d.ts +8 -0
  285. package/dist/dts/MergeState.d.ts.map +1 -1
  286. package/dist/dts/MergeStrategy.d.ts +12 -0
  287. package/dist/dts/MergeStrategy.d.ts.map +1 -1
  288. package/dist/dts/Metric.d.ts +410 -0
  289. package/dist/dts/Metric.d.ts.map +1 -1
  290. package/dist/dts/MetricHook.d.ts +24 -0
  291. package/dist/dts/MetricHook.d.ts.map +1 -1
  292. package/dist/dts/MetricKey.d.ts +48 -0
  293. package/dist/dts/MetricKey.d.ts.map +1 -1
  294. package/dist/dts/MetricPolling.d.ts +40 -0
  295. package/dist/dts/MetricPolling.d.ts.map +1 -1
  296. package/dist/dts/MetricState.d.ts +16 -0
  297. package/dist/dts/MetricState.d.ts.map +1 -1
  298. package/dist/dts/Micro.d.ts +1110 -0
  299. package/dist/dts/Micro.d.ts.map +1 -1
  300. package/dist/dts/MutableHashMap.d.ts +50 -0
  301. package/dist/dts/MutableHashMap.d.ts.map +1 -1
  302. package/dist/dts/MutableHashSet.d.ts +24 -0
  303. package/dist/dts/MutableHashSet.d.ts.map +1 -1
  304. package/dist/dts/MutableList.d.ts +36 -0
  305. package/dist/dts/MutableList.d.ts.map +1 -1
  306. package/dist/dts/MutableQueue.d.ts +62 -0
  307. package/dist/dts/MutableQueue.d.ts.map +1 -1
  308. package/dist/dts/MutableRef.d.ts +56 -0
  309. package/dist/dts/MutableRef.d.ts.map +1 -1
  310. package/dist/dts/Number.d.ts +474 -0
  311. package/dist/dts/Number.d.ts.map +1 -1
  312. package/dist/dts/Option.d.ts +1019 -0
  313. package/dist/dts/Option.d.ts.map +1 -1
  314. package/dist/dts/Order.d.ts +24 -0
  315. package/dist/dts/Order.d.ts.map +1 -1
  316. package/dist/dts/Ordering.d.ts +66 -0
  317. package/dist/dts/Ordering.d.ts.map +1 -1
  318. package/dist/dts/Pipeable.d.ts +21 -21
  319. package/dist/dts/Pipeable.d.ts.map +1 -1
  320. package/dist/dts/Pool.d.ts +37 -1
  321. package/dist/dts/Pool.d.ts.map +1 -1
  322. package/dist/dts/Predicate.d.ts +513 -0
  323. package/dist/dts/Predicate.d.ts.map +1 -1
  324. package/dist/dts/PubSub.d.ts +28 -0
  325. package/dist/dts/PubSub.d.ts.map +1 -1
  326. package/dist/dts/Queue.d.ts +106 -2
  327. package/dist/dts/Queue.d.ts.map +1 -1
  328. package/dist/dts/RcMap.d.ts +70 -0
  329. package/dist/dts/RcMap.d.ts.map +1 -1
  330. package/dist/dts/Readable.d.ts +16 -0
  331. package/dist/dts/Readable.d.ts.map +1 -1
  332. package/dist/dts/Record.d.ts +800 -0
  333. package/dist/dts/Record.d.ts.map +1 -1
  334. package/dist/dts/RedBlackTree.d.ts +300 -0
  335. package/dist/dts/RedBlackTree.d.ts.map +1 -1
  336. package/dist/dts/Ref.d.ts +88 -0
  337. package/dist/dts/Ref.d.ts.map +1 -1
  338. package/dist/dts/RegExp.d.ts +12 -2
  339. package/dist/dts/RegExp.d.ts.map +1 -1
  340. package/dist/dts/Request.d.ts +76 -0
  341. package/dist/dts/Request.d.ts.map +1 -1
  342. package/dist/dts/RequestResolver.d.ts +144 -0
  343. package/dist/dts/RequestResolver.d.ts.map +1 -1
  344. package/dist/dts/Resource.d.ts +21 -1
  345. package/dist/dts/Resource.d.ts.map +1 -1
  346. package/dist/dts/Runtime.d.ts +126 -0
  347. package/dist/dts/Runtime.d.ts.map +1 -1
  348. package/dist/dts/RuntimeFlags.d.ts +100 -0
  349. package/dist/dts/RuntimeFlags.d.ts.map +1 -1
  350. package/dist/dts/RuntimeFlagsPatch.d.ts +112 -0
  351. package/dist/dts/RuntimeFlagsPatch.d.ts.map +1 -1
  352. package/dist/dts/STM.d.ts +1090 -0
  353. package/dist/dts/STM.d.ts.map +1 -1
  354. package/dist/dts/Schedule.d.ts +704 -0
  355. package/dist/dts/Schedule.d.ts.map +1 -1
  356. package/dist/dts/ScheduleInterval.d.ts +68 -0
  357. package/dist/dts/ScheduleInterval.d.ts.map +1 -1
  358. package/dist/dts/ScheduleIntervals.d.ts +50 -0
  359. package/dist/dts/ScheduleIntervals.d.ts.map +1 -1
  360. package/dist/dts/Scope.d.ts +36 -0
  361. package/dist/dts/Scope.d.ts.map +1 -1
  362. package/dist/dts/ScopedRef.d.ts +43 -1
  363. package/dist/dts/ScopedRef.d.ts.map +1 -1
  364. package/dist/dts/Sink.d.ts +464 -0
  365. package/dist/dts/Sink.d.ts.map +1 -1
  366. package/dist/dts/SortedMap.d.ts +76 -0
  367. package/dist/dts/SortedMap.d.ts.map +1 -1
  368. package/dist/dts/SortedSet.d.ts +142 -0
  369. package/dist/dts/SortedSet.d.ts.map +1 -1
  370. package/dist/dts/Stream.d.ts +4998 -1
  371. package/dist/dts/Stream.d.ts.map +1 -1
  372. package/dist/dts/StreamHaltStrategy.d.ts +12 -0
  373. package/dist/dts/StreamHaltStrategy.d.ts.map +1 -1
  374. package/dist/dts/String.d.ts +200 -0
  375. package/dist/dts/String.d.ts.map +1 -1
  376. package/dist/dts/Struct.d.ts +84 -0
  377. package/dist/dts/Struct.d.ts.map +1 -1
  378. package/dist/dts/Subscribable.d.ts +16 -0
  379. package/dist/dts/Subscribable.d.ts.map +1 -1
  380. package/dist/dts/SubscriptionRef.d.ts +152 -0
  381. package/dist/dts/SubscriptionRef.d.ts.map +1 -1
  382. package/dist/dts/SynchronizedRef.d.ts +152 -0
  383. package/dist/dts/SynchronizedRef.d.ts.map +1 -1
  384. package/dist/dts/TArray.d.ts +426 -0
  385. package/dist/dts/TArray.d.ts.map +1 -1
  386. package/dist/dts/TDeferred.d.ts +24 -0
  387. package/dist/dts/TDeferred.d.ts.map +1 -1
  388. package/dist/dts/TMap.d.ts +366 -0
  389. package/dist/dts/TMap.d.ts.map +1 -1
  390. package/dist/dts/TPriorityQueue.d.ts +60 -0
  391. package/dist/dts/TPriorityQueue.d.ts.map +1 -1
  392. package/dist/dts/TPubSub.d.ts +28 -0
  393. package/dist/dts/TPubSub.d.ts.map +1 -1
  394. package/dist/dts/TQueue.d.ts +108 -0
  395. package/dist/dts/TQueue.d.ts.map +1 -1
  396. package/dist/dts/TReentrantLock.d.ts +36 -0
  397. package/dist/dts/TReentrantLock.d.ts.map +1 -1
  398. package/dist/dts/TRef.d.ts +88 -0
  399. package/dist/dts/TRef.d.ts.map +1 -1
  400. package/dist/dts/TSemaphore.d.ts +40 -0
  401. package/dist/dts/TSemaphore.d.ts.map +1 -1
  402. package/dist/dts/TSet.d.ts +254 -0
  403. package/dist/dts/TSet.d.ts.map +1 -1
  404. package/dist/dts/Take.d.ts +56 -0
  405. package/dist/dts/Take.d.ts.map +1 -1
  406. package/dist/dts/TestAnnotationMap.d.ts.map +1 -1
  407. package/dist/dts/TestClock.d.ts.map +1 -1
  408. package/dist/dts/TestServices.d.ts.map +1 -1
  409. package/dist/dts/Trie.d.ts +906 -0
  410. package/dist/dts/Trie.d.ts.map +1 -1
  411. package/dist/dts/Tuple.d.ts +203 -0
  412. package/dist/dts/Tuple.d.ts.map +1 -1
  413. package/dist/dts/Types.d.ts +39 -0
  414. package/dist/dts/Types.d.ts.map +1 -1
  415. package/dist/dts/Unify.d.ts +26 -13
  416. package/dist/dts/Unify.d.ts.map +1 -1
  417. package/dist/dts/UpstreamPullRequest.d.ts +12 -0
  418. package/dist/dts/UpstreamPullRequest.d.ts.map +1 -1
  419. package/dist/dts/UpstreamPullStrategy.d.ts +12 -0
  420. package/dist/dts/UpstreamPullStrategy.d.ts.map +1 -1
  421. package/dist/dts/Utils.d.ts.map +1 -1
  422. package/dist/dts/internal/core.d.ts.map +1 -1
  423. package/dist/dts/internal/hashMap.d.ts.map +1 -1
  424. package/dist/dts/internal/layer.d.ts.map +1 -1
  425. package/dist/dts/internal/managedRuntime/circular.d.ts +2 -0
  426. package/dist/dts/internal/managedRuntime/circular.d.ts.map +1 -0
  427. package/dist/dts/internal/stream.d.ts.map +1 -1
  428. package/dist/esm/Array.js +21 -0
  429. package/dist/esm/Array.js.map +1 -1
  430. package/dist/esm/BigDecimal.js +6 -3
  431. package/dist/esm/BigDecimal.js.map +1 -1
  432. package/dist/esm/BigInt.js.map +1 -1
  433. package/dist/esm/Boolean.js.map +1 -1
  434. package/dist/esm/Cause.js.map +1 -1
  435. package/dist/esm/Channel.js.map +1 -1
  436. package/dist/esm/ChildExecutorDecision.js.map +1 -1
  437. package/dist/esm/Chunk.js +4 -1
  438. package/dist/esm/Chunk.js.map +1 -1
  439. package/dist/esm/Config.js.map +1 -1
  440. package/dist/esm/ConfigError.js.map +1 -1
  441. package/dist/esm/ConfigProvider.js.map +1 -1
  442. package/dist/esm/ConfigProviderPathPatch.js.map +1 -1
  443. package/dist/esm/Console.js.map +1 -1
  444. package/dist/esm/Context.js.map +1 -1
  445. package/dist/esm/Cron.js +4 -1
  446. package/dist/esm/Cron.js.map +1 -1
  447. package/dist/esm/Data.js.map +1 -1
  448. package/dist/esm/DateTime.js +6 -0
  449. package/dist/esm/DateTime.js.map +1 -1
  450. package/dist/esm/Deferred.js.map +1 -1
  451. package/dist/esm/Differ.js.map +1 -1
  452. package/dist/esm/Duration.js +4 -1
  453. package/dist/esm/Duration.js.map +1 -1
  454. package/dist/esm/Effect.js +116 -30
  455. package/dist/esm/Effect.js.map +1 -1
  456. package/dist/esm/Either.js.map +1 -1
  457. package/dist/esm/Equivalence.js.map +1 -1
  458. package/dist/esm/ExecutionStrategy.js.map +1 -1
  459. package/dist/esm/Exit.js.map +1 -1
  460. package/dist/esm/Fiber.js.map +1 -1
  461. package/dist/esm/FiberHandle.js +3 -0
  462. package/dist/esm/FiberHandle.js.map +1 -1
  463. package/dist/esm/FiberId.js.map +1 -1
  464. package/dist/esm/FiberMap.js +3 -0
  465. package/dist/esm/FiberMap.js.map +1 -1
  466. package/dist/esm/FiberRef.js.map +1 -1
  467. package/dist/esm/FiberRefs.js.map +1 -1
  468. package/dist/esm/FiberRefsPatch.js.map +1 -1
  469. package/dist/esm/FiberSet.js +3 -0
  470. package/dist/esm/FiberSet.js.map +1 -1
  471. package/dist/esm/Function.js.map +1 -1
  472. package/dist/esm/GroupBy.js.map +1 -1
  473. package/dist/esm/Hash.js.map +1 -1
  474. package/dist/esm/HashMap.js.map +1 -1
  475. package/dist/esm/HashSet.js.map +1 -1
  476. package/dist/esm/Inspectable.js +14 -0
  477. package/dist/esm/Inspectable.js.map +1 -1
  478. package/dist/esm/Iterable.js.map +1 -1
  479. package/dist/esm/KeyedPool.js.map +1 -1
  480. package/dist/esm/Layer.js.map +1 -1
  481. package/dist/esm/List.js +7 -1
  482. package/dist/esm/List.js.map +1 -1
  483. package/dist/esm/LogLevel.js.map +1 -1
  484. package/dist/esm/Logger.js.map +1 -1
  485. package/dist/esm/Mailbox.js.map +1 -1
  486. package/dist/esm/ManagedRuntime.js +15 -0
  487. package/dist/esm/ManagedRuntime.js.map +1 -1
  488. package/dist/esm/MergeDecision.js.map +1 -1
  489. package/dist/esm/MergeState.js.map +1 -1
  490. package/dist/esm/MergeStrategy.js.map +1 -1
  491. package/dist/esm/Metric.js.map +1 -1
  492. package/dist/esm/MetricHook.js.map +1 -1
  493. package/dist/esm/MetricKey.js.map +1 -1
  494. package/dist/esm/MetricPolling.js.map +1 -1
  495. package/dist/esm/MetricState.js.map +1 -1
  496. package/dist/esm/Micro.js +7 -1
  497. package/dist/esm/Micro.js.map +1 -1
  498. package/dist/esm/MutableHashMap.js +4 -1
  499. package/dist/esm/MutableHashMap.js.map +1 -1
  500. package/dist/esm/MutableHashSet.js +4 -1
  501. package/dist/esm/MutableHashSet.js.map +1 -1
  502. package/dist/esm/MutableList.js +4 -1
  503. package/dist/esm/MutableList.js.map +1 -1
  504. package/dist/esm/MutableQueue.js +4 -1
  505. package/dist/esm/MutableQueue.js.map +1 -1
  506. package/dist/esm/MutableRef.js +4 -1
  507. package/dist/esm/MutableRef.js.map +1 -1
  508. package/dist/esm/Number.js.map +1 -1
  509. package/dist/esm/Option.js.map +1 -1
  510. package/dist/esm/Order.js.map +1 -1
  511. package/dist/esm/Ordering.js.map +1 -1
  512. package/dist/esm/Pipeable.js.map +1 -1
  513. package/dist/esm/Pool.js.map +1 -1
  514. package/dist/esm/Predicate.js +15 -0
  515. package/dist/esm/Predicate.js.map +1 -1
  516. package/dist/esm/PubSub.js.map +1 -1
  517. package/dist/esm/Queue.js.map +1 -1
  518. package/dist/esm/RcMap.js.map +1 -1
  519. package/dist/esm/Readable.js.map +1 -1
  520. package/dist/esm/Record.js.map +1 -1
  521. package/dist/esm/RedBlackTree.js.map +1 -1
  522. package/dist/esm/Ref.js.map +1 -1
  523. package/dist/esm/RegExp.js +16 -0
  524. package/dist/esm/RegExp.js.map +1 -1
  525. package/dist/esm/Request.js.map +1 -1
  526. package/dist/esm/RequestResolver.js.map +1 -1
  527. package/dist/esm/Resource.js.map +1 -1
  528. package/dist/esm/Runtime.js.map +1 -1
  529. package/dist/esm/RuntimeFlags.js.map +1 -1
  530. package/dist/esm/RuntimeFlagsPatch.js.map +1 -1
  531. package/dist/esm/STM.js.map +1 -1
  532. package/dist/esm/Schedule.js.map +1 -1
  533. package/dist/esm/ScheduleInterval.js.map +1 -1
  534. package/dist/esm/ScheduleIntervals.js.map +1 -1
  535. package/dist/esm/Scheduler.js.map +1 -1
  536. package/dist/esm/Scope.js.map +1 -1
  537. package/dist/esm/ScopedRef.js.map +1 -1
  538. package/dist/esm/Sink.js.map +1 -1
  539. package/dist/esm/SortedMap.js +4 -1
  540. package/dist/esm/SortedMap.js.map +1 -1
  541. package/dist/esm/SortedSet.js +4 -1
  542. package/dist/esm/SortedSet.js.map +1 -1
  543. package/dist/esm/Stream.js +14 -0
  544. package/dist/esm/Stream.js.map +1 -1
  545. package/dist/esm/StreamHaltStrategy.js.map +1 -1
  546. package/dist/esm/String.js.map +1 -1
  547. package/dist/esm/Struct.js.map +1 -1
  548. package/dist/esm/Subscribable.js.map +1 -1
  549. package/dist/esm/SubscriptionRef.js.map +1 -1
  550. package/dist/esm/SynchronizedRef.js.map +1 -1
  551. package/dist/esm/TArray.js.map +1 -1
  552. package/dist/esm/TDeferred.js.map +1 -1
  553. package/dist/esm/TMap.js.map +1 -1
  554. package/dist/esm/TPriorityQueue.js.map +1 -1
  555. package/dist/esm/TPubSub.js.map +1 -1
  556. package/dist/esm/TQueue.js.map +1 -1
  557. package/dist/esm/TReentrantLock.js.map +1 -1
  558. package/dist/esm/TRef.js.map +1 -1
  559. package/dist/esm/TSemaphore.js.map +1 -1
  560. package/dist/esm/TSet.js.map +1 -1
  561. package/dist/esm/Take.js.map +1 -1
  562. package/dist/esm/TestAnnotationMap.js.map +1 -1
  563. package/dist/esm/TestClock.js.map +1 -1
  564. package/dist/esm/TestServices.js.map +1 -1
  565. package/dist/esm/Trie.js.map +1 -1
  566. package/dist/esm/Tuple.js +19 -0
  567. package/dist/esm/Tuple.js.map +1 -1
  568. package/dist/esm/Unify.js.map +1 -1
  569. package/dist/esm/UpstreamPullRequest.js.map +1 -1
  570. package/dist/esm/UpstreamPullStrategy.js.map +1 -1
  571. package/dist/esm/Utils.js +1 -14
  572. package/dist/esm/Utils.js.map +1 -1
  573. package/dist/esm/internal/cause.js +4 -1
  574. package/dist/esm/internal/cause.js.map +1 -1
  575. package/dist/esm/internal/context.js +7 -2
  576. package/dist/esm/internal/context.js.map +1 -1
  577. package/dist/esm/internal/core-effect.js.map +1 -1
  578. package/dist/esm/internal/core.js +14 -2
  579. package/dist/esm/internal/core.js.map +1 -1
  580. package/dist/esm/internal/effect/circular.js +5 -1
  581. package/dist/esm/internal/effect/circular.js.map +1 -1
  582. package/dist/esm/internal/fiberId.js +10 -1
  583. package/dist/esm/internal/fiberId.js.map +1 -1
  584. package/dist/esm/internal/hashMap.js +4 -1
  585. package/dist/esm/internal/hashMap.js.map +1 -1
  586. package/dist/esm/internal/hashSet.js +4 -1
  587. package/dist/esm/internal/hashSet.js.map +1 -1
  588. package/dist/esm/internal/layer.js +32 -18
  589. package/dist/esm/internal/layer.js.map +1 -1
  590. package/dist/esm/internal/mailbox.js +3 -0
  591. package/dist/esm/internal/mailbox.js.map +1 -1
  592. package/dist/esm/internal/managedRuntime/circular.js +4 -0
  593. package/dist/esm/internal/managedRuntime/circular.js.map +1 -0
  594. package/dist/esm/internal/managedRuntime.js +21 -8
  595. package/dist/esm/internal/managedRuntime.js.map +1 -1
  596. package/dist/esm/internal/option.js +4 -1
  597. package/dist/esm/internal/option.js.map +1 -1
  598. package/dist/esm/internal/pool.js +6 -1
  599. package/dist/esm/internal/pool.js.map +1 -1
  600. package/dist/esm/internal/redBlackTree.js +4 -1
  601. package/dist/esm/internal/redBlackTree.js.map +1 -1
  602. package/dist/esm/internal/resource.js +15 -5
  603. package/dist/esm/internal/resource.js.map +1 -1
  604. package/dist/esm/internal/runtime.js +4 -1
  605. package/dist/esm/internal/runtime.js.map +1 -1
  606. package/dist/esm/internal/scopedRef.js +11 -8
  607. package/dist/esm/internal/scopedRef.js.map +1 -1
  608. package/dist/esm/internal/stm/core.js +1 -2
  609. package/dist/esm/internal/stm/core.js.map +1 -1
  610. package/dist/esm/internal/stream.js +9 -0
  611. package/dist/esm/internal/stream.js.map +1 -1
  612. package/dist/esm/internal/trie.js +4 -1
  613. package/dist/esm/internal/trie.js.map +1 -1
  614. package/dist/esm/internal/version.js +1 -1
  615. package/package.json +1 -1
  616. package/src/Array.ts +2791 -40
  617. package/src/BigDecimal.ts +589 -19
  618. package/src/BigInt.ts +516 -16
  619. package/src/Boolean.ts +241 -8
  620. package/src/Cause.ts +177 -1
  621. package/src/Channel.ts +766 -49
  622. package/src/ChildExecutorDecision.ts +12 -0
  623. package/src/Chunk.ts +822 -5
  624. package/src/Config.ts +187 -8
  625. package/src/ConfigError.ts +16 -0
  626. package/src/ConfigProvider.ts +89 -1
  627. package/src/ConfigProviderPathPatch.ts +32 -0
  628. package/src/Console.ts +37 -8
  629. package/src/Context.ts +234 -3
  630. package/src/Cron.ts +16 -1
  631. package/src/Data.ts +165 -0
  632. package/src/DateTime.ts +1012 -50
  633. package/src/Deferred.ts +171 -1
  634. package/src/Differ.ts +89 -27
  635. package/src/Duration.ts +160 -17
  636. package/src/Effect.ts +4717 -164
  637. package/src/Either.ts +650 -34
  638. package/src/Equivalence.ts +24 -0
  639. package/src/ExecutionStrategy.ts +29 -10
  640. package/src/Exit.ts +252 -0
  641. package/src/Fiber.ts +182 -0
  642. package/src/FiberHandle.ts +45 -0
  643. package/src/FiberId.ts +24 -0
  644. package/src/FiberMap.ts +147 -21
  645. package/src/FiberRef.ts +80 -0
  646. package/src/FiberRefs.ts +84 -0
  647. package/src/FiberRefsPatch.ts +35 -1
  648. package/src/FiberSet.ts +41 -0
  649. package/src/Function.ts +416 -31
  650. package/src/GroupBy.ts +38 -0
  651. package/src/Hash.ts +8 -0
  652. package/src/HashMap.ts +316 -0
  653. package/src/HashSet.ts +284 -0
  654. package/src/Inspectable.ts +22 -0
  655. package/src/Iterable.ts +456 -6
  656. package/src/KeyedPool.ts +34 -0
  657. package/src/Layer.ts +475 -38
  658. package/src/List.ts +483 -4
  659. package/src/LogLevel.ts +46 -0
  660. package/src/Logger.ts +195 -4
  661. package/src/Mailbox.ts +16 -0
  662. package/src/ManagedRuntime.ts +46 -2
  663. package/src/MergeDecision.ts +8 -0
  664. package/src/MergeState.ts +8 -0
  665. package/src/MergeStrategy.ts +25 -8
  666. package/src/Metric.ts +426 -15
  667. package/src/MetricHook.ts +24 -0
  668. package/src/MetricKey.ts +62 -8
  669. package/src/MetricPolling.ts +42 -6
  670. package/src/MetricState.ts +16 -0
  671. package/src/Micro.ts +1223 -61
  672. package/src/MutableHashMap.ts +109 -2
  673. package/src/MutableHashSet.ts +28 -1
  674. package/src/MutableList.ts +40 -1
  675. package/src/MutableQueue.ts +66 -1
  676. package/src/MutableRef.ts +60 -1
  677. package/src/Number.ts +500 -16
  678. package/src/Option.ts +1042 -16
  679. package/src/Order.ts +24 -0
  680. package/src/Ordering.ts +66 -0
  681. package/src/Pipeable.ts +224 -21
  682. package/src/Pool.ts +42 -1
  683. package/src/Predicate.ts +514 -0
  684. package/src/PubSub.ts +28 -0
  685. package/src/Queue.ts +106 -2
  686. package/src/RcMap.ts +70 -0
  687. package/src/Readable.ts +18 -7
  688. package/src/Record.ts +814 -40
  689. package/src/RedBlackTree.ts +305 -1
  690. package/src/Ref.ts +88 -0
  691. package/src/RegExp.ts +17 -0
  692. package/src/Request.ts +76 -0
  693. package/src/RequestResolver.ts +145 -4
  694. package/src/Resource.ts +22 -1
  695. package/src/Runtime.ts +134 -2
  696. package/src/RuntimeFlags.ts +100 -0
  697. package/src/RuntimeFlagsPatch.ts +112 -0
  698. package/src/STM.ts +1107 -11
  699. package/src/Schedule.ts +704 -0
  700. package/src/ScheduleInterval.ts +68 -0
  701. package/src/ScheduleIntervals.ts +50 -0
  702. package/src/Scheduler.ts +2 -0
  703. package/src/Scope.ts +36 -0
  704. package/src/ScopedRef.ts +44 -1
  705. package/src/Sink.ts +464 -0
  706. package/src/SortedMap.ts +80 -1
  707. package/src/SortedSet.ts +147 -4
  708. package/src/Stream.ts +5041 -54
  709. package/src/StreamHaltStrategy.ts +29 -12
  710. package/src/String.ts +200 -0
  711. package/src/Struct.ts +86 -7
  712. package/src/Subscribable.ts +16 -0
  713. package/src/SubscriptionRef.ts +159 -11
  714. package/src/SynchronizedRef.ts +169 -8
  715. package/src/TArray.ts +431 -1
  716. package/src/TDeferred.ts +24 -0
  717. package/src/TMap.ts +381 -12
  718. package/src/TPriorityQueue.ts +60 -0
  719. package/src/TPubSub.ts +28 -0
  720. package/src/TQueue.ts +108 -0
  721. package/src/TReentrantLock.ts +36 -0
  722. package/src/TRef.ts +88 -0
  723. package/src/TSemaphore.ts +40 -0
  724. package/src/TSet.ts +280 -12
  725. package/src/Take.ts +56 -0
  726. package/src/TestAnnotationMap.ts +45 -1
  727. package/src/TestClock.ts +6 -0
  728. package/src/TestServices.ts +66 -0
  729. package/src/Trie.ts +906 -0
  730. package/src/Tuple.ts +223 -8
  731. package/src/Types.ts +41 -0
  732. package/src/Unify.ts +28 -17
  733. package/src/UpstreamPullRequest.ts +12 -0
  734. package/src/UpstreamPullStrategy.ts +12 -0
  735. package/src/Utils.ts +1 -15
  736. package/src/internal/cause.ts +4 -1
  737. package/src/internal/context.ts +7 -2
  738. package/src/internal/core-effect.ts +7 -7
  739. package/src/internal/core.ts +14 -2
  740. package/src/internal/effect/circular.ts +8 -2
  741. package/src/internal/fiberId.ts +10 -1
  742. package/src/internal/hashMap.ts +4 -1
  743. package/src/internal/hashSet.ts +4 -1
  744. package/src/internal/layer.ts +105 -38
  745. package/src/internal/mailbox.ts +3 -0
  746. package/src/internal/managedRuntime/circular.ts +6 -0
  747. package/src/internal/managedRuntime.ts +36 -22
  748. package/src/internal/option.ts +4 -1
  749. package/src/internal/pool.ts +7 -1
  750. package/src/internal/redBlackTree.ts +4 -1
  751. package/src/internal/resource.ts +16 -5
  752. package/src/internal/runtime.ts +4 -1
  753. package/src/internal/scopedRef.ts +12 -8
  754. package/src/internal/stm/core.ts +2 -3
  755. package/src/internal/stream.ts +27 -0
  756. package/src/internal/trie.ts +4 -1
  757. package/src/internal/version.ts +1 -1
@@ -175,10 +175,58 @@ export declare const isSome: <A>(self: Option<A>) => self is Some<A>;
175
175
  * @since 2.0.0
176
176
  */
177
177
  export declare const match: {
178
+ /**
179
+ * Matches the given `Option` and returns either the provided `onNone` value or the result of the provided `onSome`
180
+ * function when passed the `Option`'s value.
181
+ *
182
+ * @param self - The `Option` to match
183
+ * @param onNone - The value to be returned if the `Option` is `None`
184
+ * @param onSome - The function to be called if the `Option` is `Some`, it will be passed the `Option`'s value and its result will be returned
185
+ *
186
+ * @example
187
+ * import { pipe, Option } from "effect"
188
+ *
189
+ * assert.deepStrictEqual(
190
+ * pipe(Option.some(1), Option.match({ onNone: () => 'a none', onSome: (a) => `a some containing ${a}` })),
191
+ * 'a some containing 1'
192
+ * )
193
+ *
194
+ * assert.deepStrictEqual(
195
+ * pipe(Option.none(), Option.match({ onNone: () => 'a none', onSome: (a) => `a some containing ${a}` })),
196
+ * 'a none'
197
+ * )
198
+ *
199
+ * @category pattern matching
200
+ * @since 2.0.0
201
+ */
178
202
  <B, A, C = B>(options: {
179
203
  readonly onNone: LazyArg<B>;
180
204
  readonly onSome: (a: A) => C;
181
205
  }): (self: Option<A>) => B | C;
206
+ /**
207
+ * Matches the given `Option` and returns either the provided `onNone` value or the result of the provided `onSome`
208
+ * function when passed the `Option`'s value.
209
+ *
210
+ * @param self - The `Option` to match
211
+ * @param onNone - The value to be returned if the `Option` is `None`
212
+ * @param onSome - The function to be called if the `Option` is `Some`, it will be passed the `Option`'s value and its result will be returned
213
+ *
214
+ * @example
215
+ * import { pipe, Option } from "effect"
216
+ *
217
+ * assert.deepStrictEqual(
218
+ * pipe(Option.some(1), Option.match({ onNone: () => 'a none', onSome: (a) => `a some containing ${a}` })),
219
+ * 'a some containing 1'
220
+ * )
221
+ *
222
+ * assert.deepStrictEqual(
223
+ * pipe(Option.none(), Option.match({ onNone: () => 'a none', onSome: (a) => `a some containing ${a}` })),
224
+ * 'a none'
225
+ * )
226
+ *
227
+ * @category pattern matching
228
+ * @since 2.0.0
229
+ */
182
230
  <A, B, C = B>(self: Option<A>, options: {
183
231
  readonly onNone: LazyArg<B>;
184
232
  readonly onSome: (a: A) => C;
@@ -261,7 +309,37 @@ export declare const getLeft: <R, L>(self: Either<R, L>) => Option<L>;
261
309
  * @since 2.0.0
262
310
  */
263
311
  export declare const getOrElse: {
312
+ /**
313
+ * Returns the value of the `Option` if it is `Some`, otherwise returns `onNone`
314
+ *
315
+ * @param self - The `Option` to get the value of.
316
+ * @param onNone - Function that returns the default value to return if the `Option` is `None`.
317
+ *
318
+ * @example
319
+ * import { pipe, Option } from "effect"
320
+ *
321
+ * assert.deepStrictEqual(pipe(Option.some(1), Option.getOrElse(() => 0)), 1)
322
+ * assert.deepStrictEqual(pipe(Option.none(), Option.getOrElse(() => 0)), 0)
323
+ *
324
+ * @category getters
325
+ * @since 2.0.0
326
+ */
264
327
  <B>(onNone: LazyArg<B>): <A>(self: Option<A>) => B | A;
328
+ /**
329
+ * Returns the value of the `Option` if it is `Some`, otherwise returns `onNone`
330
+ *
331
+ * @param self - The `Option` to get the value of.
332
+ * @param onNone - Function that returns the default value to return if the `Option` is `None`.
333
+ *
334
+ * @example
335
+ * import { pipe, Option } from "effect"
336
+ *
337
+ * assert.deepStrictEqual(pipe(Option.some(1), Option.getOrElse(() => 0)), 1)
338
+ * assert.deepStrictEqual(pipe(Option.none(), Option.getOrElse(() => 0)), 0)
339
+ *
340
+ * @category getters
341
+ * @since 2.0.0
342
+ */
265
343
  <A, B>(self: Option<A>, onNone: LazyArg<B>): A | B;
266
344
  };
267
345
  /**
@@ -306,7 +384,89 @@ export declare const getOrElse: {
306
384
  * @since 2.0.0
307
385
  */
308
386
  export declare const orElse: {
387
+ /**
388
+ * Returns the provided `Option` `that` if `self` is `None`, otherwise returns `self`.
389
+ *
390
+ * @param self - The first `Option` to be checked.
391
+ * @param that - The `Option` to return if `self` is `None`.
392
+ *
393
+ * @example
394
+ * import { pipe, Option } from "effect"
395
+ *
396
+ * assert.deepStrictEqual(
397
+ * pipe(
398
+ * Option.none(),
399
+ * Option.orElse(() => Option.none())
400
+ * ),
401
+ * Option.none()
402
+ * )
403
+ * assert.deepStrictEqual(
404
+ * pipe(
405
+ * Option.some('a'),
406
+ * Option.orElse(() => Option.none())
407
+ * ),
408
+ * Option.some('a')
409
+ * )
410
+ * assert.deepStrictEqual(
411
+ * pipe(
412
+ * Option.none(),
413
+ * Option.orElse(() => Option.some('b'))
414
+ * ),
415
+ * Option.some('b')
416
+ * )
417
+ * assert.deepStrictEqual(
418
+ * pipe(
419
+ * Option.some('a'),
420
+ * Option.orElse(() => Option.some('b'))
421
+ * ),
422
+ * Option.some('a')
423
+ * )
424
+ *
425
+ * @category error handling
426
+ * @since 2.0.0
427
+ */
309
428
  <B>(that: LazyArg<Option<B>>): <A>(self: Option<A>) => Option<B | A>;
429
+ /**
430
+ * Returns the provided `Option` `that` if `self` is `None`, otherwise returns `self`.
431
+ *
432
+ * @param self - The first `Option` to be checked.
433
+ * @param that - The `Option` to return if `self` is `None`.
434
+ *
435
+ * @example
436
+ * import { pipe, Option } from "effect"
437
+ *
438
+ * assert.deepStrictEqual(
439
+ * pipe(
440
+ * Option.none(),
441
+ * Option.orElse(() => Option.none())
442
+ * ),
443
+ * Option.none()
444
+ * )
445
+ * assert.deepStrictEqual(
446
+ * pipe(
447
+ * Option.some('a'),
448
+ * Option.orElse(() => Option.none())
449
+ * ),
450
+ * Option.some('a')
451
+ * )
452
+ * assert.deepStrictEqual(
453
+ * pipe(
454
+ * Option.none(),
455
+ * Option.orElse(() => Option.some('b'))
456
+ * ),
457
+ * Option.some('b')
458
+ * )
459
+ * assert.deepStrictEqual(
460
+ * pipe(
461
+ * Option.some('a'),
462
+ * Option.orElse(() => Option.some('b'))
463
+ * ),
464
+ * Option.some('a')
465
+ * )
466
+ *
467
+ * @category error handling
468
+ * @since 2.0.0
469
+ */
310
470
  <A, B>(self: Option<A>, that: LazyArg<Option<B>>): Option<A | B>;
311
471
  };
312
472
  /**
@@ -337,7 +497,61 @@ export declare const orElse: {
337
497
  * @since 2.0.0
338
498
  */
339
499
  export declare const orElseSome: {
500
+ /**
501
+ * Returns the provided default value as `Some` if `self` is `None`, otherwise returns `self`.
502
+ *
503
+ * @param self - The first `Option` to be checked.
504
+ * @param onNone - Function that returns the default value to return if the `Option` is `None`.
505
+ *
506
+ * @example
507
+ * import { pipe, Option } from "effect"
508
+ *
509
+ * assert.deepStrictEqual(
510
+ * pipe(
511
+ * Option.none(),
512
+ * Option.orElseSome(() => 'b')
513
+ * ),
514
+ * Option.some('b')
515
+ * )
516
+ * assert.deepStrictEqual(
517
+ * pipe(
518
+ * Option.some('a'),
519
+ * Option.orElseSome(() => 'b')
520
+ * ),
521
+ * Option.some('a')
522
+ * )
523
+ *
524
+ * @category error handling
525
+ * @since 2.0.0
526
+ */
340
527
  <B>(onNone: LazyArg<B>): <A>(self: Option<A>) => Option<B | A>;
528
+ /**
529
+ * Returns the provided default value as `Some` if `self` is `None`, otherwise returns `self`.
530
+ *
531
+ * @param self - The first `Option` to be checked.
532
+ * @param onNone - Function that returns the default value to return if the `Option` is `None`.
533
+ *
534
+ * @example
535
+ * import { pipe, Option } from "effect"
536
+ *
537
+ * assert.deepStrictEqual(
538
+ * pipe(
539
+ * Option.none(),
540
+ * Option.orElseSome(() => 'b')
541
+ * ),
542
+ * Option.some('b')
543
+ * )
544
+ * assert.deepStrictEqual(
545
+ * pipe(
546
+ * Option.some('a'),
547
+ * Option.orElseSome(() => 'b')
548
+ * ),
549
+ * Option.some('a')
550
+ * )
551
+ *
552
+ * @category error handling
553
+ * @since 2.0.0
554
+ */
341
555
  <A, B>(self: Option<A>, onNone: LazyArg<B>): Option<A | B>;
342
556
  };
343
557
  /**
@@ -353,7 +567,31 @@ export declare const orElseSome: {
353
567
  * @since 2.0.0
354
568
  */
355
569
  export declare const orElseEither: {
570
+ /**
571
+ * Similar to `orElse`, but instead of returning a simple union, it returns an `Either` object,
572
+ * which contains information about which of the two `Option`s has been chosen.
573
+ *
574
+ * This is useful when it's important to know whether the value was retrieved from the first `Option` or the second option.
575
+ *
576
+ * @param self - The first `Option` to be checked.
577
+ * @param that - The second `Option` to be considered if the first `Option` is `None`.
578
+ *
579
+ * @category error handling
580
+ * @since 2.0.0
581
+ */
356
582
  <B>(that: LazyArg<Option<B>>): <A>(self: Option<A>) => Option<Either<B, A>>;
583
+ /**
584
+ * Similar to `orElse`, but instead of returning a simple union, it returns an `Either` object,
585
+ * which contains information about which of the two `Option`s has been chosen.
586
+ *
587
+ * This is useful when it's important to know whether the value was retrieved from the first `Option` or the second option.
588
+ *
589
+ * @param self - The first `Option` to be checked.
590
+ * @param that - The second `Option` to be considered if the first `Option` is `None`.
591
+ *
592
+ * @category error handling
593
+ * @since 2.0.0
594
+ */
357
595
  <A, B>(self: Option<A>, that: LazyArg<Option<B>>): Option<Either<B, A>>;
358
596
  };
359
597
  /**
@@ -478,7 +716,47 @@ export declare const liftThrowable: <A extends ReadonlyArray<unknown>, B>(f: (..
478
716
  * @since 2.0.0
479
717
  */
480
718
  export declare const getOrThrowWith: {
719
+ /**
720
+ * Extracts the value of an `Option` or throws if the `Option` is `None`.
721
+ *
722
+ * If a default error is sufficient for your use case and you don't need to configure the thrown error, see {@link getOrThrow}.
723
+ *
724
+ * @param self - The `Option` to extract the value from.
725
+ * @param onNone - A function that will be called if the `Option` is `None`. It returns the error to be thrown.
726
+ *
727
+ * @example
728
+ * import { Option } from "effect"
729
+ *
730
+ * assert.deepStrictEqual(
731
+ * Option.getOrThrowWith(Option.some(1), () => new Error('Unexpected None')),
732
+ * 1
733
+ * )
734
+ * assert.throws(() => Option.getOrThrowWith(Option.none(), () => new Error('Unexpected None')))
735
+ *
736
+ * @category conversions
737
+ * @since 2.0.0
738
+ */
481
739
  (onNone: () => unknown): <A>(self: Option<A>) => A;
740
+ /**
741
+ * Extracts the value of an `Option` or throws if the `Option` is `None`.
742
+ *
743
+ * If a default error is sufficient for your use case and you don't need to configure the thrown error, see {@link getOrThrow}.
744
+ *
745
+ * @param self - The `Option` to extract the value from.
746
+ * @param onNone - A function that will be called if the `Option` is `None`. It returns the error to be thrown.
747
+ *
748
+ * @example
749
+ * import { Option } from "effect"
750
+ *
751
+ * assert.deepStrictEqual(
752
+ * Option.getOrThrowWith(Option.some(1), () => new Error('Unexpected None')),
753
+ * 1
754
+ * )
755
+ * assert.throws(() => Option.getOrThrowWith(Option.none(), () => new Error('Unexpected None')))
756
+ *
757
+ * @category conversions
758
+ * @since 2.0.0
759
+ */
482
760
  <A>(self: Option<A>, onNone: () => unknown): A;
483
761
  };
484
762
  /**
@@ -509,7 +787,25 @@ export declare const getOrThrow: <A>(self: Option<A>) => A;
509
787
  * @since 2.0.0
510
788
  */
511
789
  export declare const map: {
790
+ /**
791
+ * Maps the `Some` side of an `Option` value to a new `Option` value.
792
+ *
793
+ * @param self - An `Option` to map
794
+ * @param f - The function to map over the value of the `Option`
795
+ *
796
+ * @category mapping
797
+ * @since 2.0.0
798
+ */
512
799
  <A, B>(f: (a: A) => B): (self: Option<A>) => Option<B>;
800
+ /**
801
+ * Maps the `Some` side of an `Option` value to a new `Option` value.
802
+ *
803
+ * @param self - An `Option` to map
804
+ * @param f - The function to map over the value of the `Option`
805
+ *
806
+ * @category mapping
807
+ * @since 2.0.0
808
+ */
513
809
  <A, B>(self: Option<A>, f: (a: A) => B): Option<B>;
514
810
  };
515
811
  /**
@@ -519,6 +815,12 @@ export declare const map: {
519
815
  * @since 2.0.0
520
816
  */
521
817
  export declare const as: {
818
+ /**
819
+ * Maps the `Some` value of this `Option` to the specified constant value.
820
+ *
821
+ * @category mapping
822
+ * @since 2.0.0
823
+ */
522
824
  <B>(b: B): <X>(self: Option<X>) => Option<B>;
523
825
  };
524
826
  /**
@@ -543,7 +845,19 @@ void_ as void };
543
845
  * @since 2.0.0
544
846
  */
545
847
  export declare const flatMap: {
848
+ /**
849
+ * Applies a function to the value of an `Option` and flattens the result, if the input is `Some`.
850
+ *
851
+ * @category sequencing
852
+ * @since 2.0.0
853
+ */
546
854
  <A, B>(f: (a: A) => Option<B>): (self: Option<A>) => Option<B>;
855
+ /**
856
+ * Applies a function to the value of an `Option` and flattens the result, if the input is `Some`.
857
+ *
858
+ * @category sequencing
859
+ * @since 2.0.0
860
+ */
547
861
  <A, B>(self: Option<A>, f: (a: A) => Option<B>): Option<B>;
548
862
  };
549
863
  /**
@@ -553,13 +867,61 @@ export declare const flatMap: {
553
867
  * @since 2.0.0
554
868
  */
555
869
  export declare const andThen: {
870
+ /**
871
+ * Executes a sequence of two `Option`s. The second `Option` can be dependent on the result of the first `Option`.
872
+ *
873
+ * @category sequencing
874
+ * @since 2.0.0
875
+ */
556
876
  <A, B>(f: (a: A) => Option<B>): (self: Option<A>) => Option<B>;
877
+ /**
878
+ * Executes a sequence of two `Option`s. The second `Option` can be dependent on the result of the first `Option`.
879
+ *
880
+ * @category sequencing
881
+ * @since 2.0.0
882
+ */
557
883
  <B>(f: Option<B>): <A>(self: Option<A>) => Option<B>;
884
+ /**
885
+ * Executes a sequence of two `Option`s. The second `Option` can be dependent on the result of the first `Option`.
886
+ *
887
+ * @category sequencing
888
+ * @since 2.0.0
889
+ */
558
890
  <A, B>(f: (a: A) => B): (self: Option<A>) => Option<B>;
891
+ /**
892
+ * Executes a sequence of two `Option`s. The second `Option` can be dependent on the result of the first `Option`.
893
+ *
894
+ * @category sequencing
895
+ * @since 2.0.0
896
+ */
559
897
  <B>(f: NotFunction<B>): <A>(self: Option<A>) => Option<B>;
898
+ /**
899
+ * Executes a sequence of two `Option`s. The second `Option` can be dependent on the result of the first `Option`.
900
+ *
901
+ * @category sequencing
902
+ * @since 2.0.0
903
+ */
560
904
  <A, B>(self: Option<A>, f: (a: A) => Option<B>): Option<B>;
905
+ /**
906
+ * Executes a sequence of two `Option`s. The second `Option` can be dependent on the result of the first `Option`.
907
+ *
908
+ * @category sequencing
909
+ * @since 2.0.0
910
+ */
561
911
  <A, B>(self: Option<A>, f: Option<B>): Option<B>;
912
+ /**
913
+ * Executes a sequence of two `Option`s. The second `Option` can be dependent on the result of the first `Option`.
914
+ *
915
+ * @category sequencing
916
+ * @since 2.0.0
917
+ */
562
918
  <A, B>(self: Option<A>, f: (a: A) => B): Option<B>;
919
+ /**
920
+ * Executes a sequence of two `Option`s. The second `Option` can be dependent on the result of the first `Option`.
921
+ *
922
+ * @category sequencing
923
+ * @since 2.0.0
924
+ */
563
925
  <A, B>(self: Option<A>, f: NotFunction<B>): Option<B>;
564
926
  };
565
927
  /**
@@ -602,7 +964,85 @@ export declare const andThen: {
602
964
  * @since 2.0.0
603
965
  */
604
966
  export declare const flatMapNullable: {
967
+ /**
968
+ * This is `flatMap` + `fromNullable`, useful when working with optional values.
969
+ *
970
+ * @example
971
+ * import { pipe, Option } from "effect"
972
+ *
973
+ * interface Employee {
974
+ * company?: {
975
+ * address?: {
976
+ * street?: {
977
+ * name?: string
978
+ * }
979
+ * }
980
+ * }
981
+ * }
982
+ *
983
+ * const employee1: Employee = { company: { address: { street: { name: 'high street' } } } }
984
+ *
985
+ * assert.deepStrictEqual(
986
+ * pipe(
987
+ * Option.some(employee1),
988
+ * Option.flatMapNullable(employee => employee.company?.address?.street?.name),
989
+ * ),
990
+ * Option.some('high street')
991
+ * )
992
+ *
993
+ * const employee2: Employee = { company: { address: { street: {} } } }
994
+ *
995
+ * assert.deepStrictEqual(
996
+ * pipe(
997
+ * Option.some(employee2),
998
+ * Option.flatMapNullable(employee => employee.company?.address?.street?.name),
999
+ * ),
1000
+ * Option.none()
1001
+ * )
1002
+ *
1003
+ * @category sequencing
1004
+ * @since 2.0.0
1005
+ */
605
1006
  <A, B>(f: (a: A) => B | null | undefined): (self: Option<A>) => Option<NonNullable<B>>;
1007
+ /**
1008
+ * This is `flatMap` + `fromNullable`, useful when working with optional values.
1009
+ *
1010
+ * @example
1011
+ * import { pipe, Option } from "effect"
1012
+ *
1013
+ * interface Employee {
1014
+ * company?: {
1015
+ * address?: {
1016
+ * street?: {
1017
+ * name?: string
1018
+ * }
1019
+ * }
1020
+ * }
1021
+ * }
1022
+ *
1023
+ * const employee1: Employee = { company: { address: { street: { name: 'high street' } } } }
1024
+ *
1025
+ * assert.deepStrictEqual(
1026
+ * pipe(
1027
+ * Option.some(employee1),
1028
+ * Option.flatMapNullable(employee => employee.company?.address?.street?.name),
1029
+ * ),
1030
+ * Option.some('high street')
1031
+ * )
1032
+ *
1033
+ * const employee2: Employee = { company: { address: { street: {} } } }
1034
+ *
1035
+ * assert.deepStrictEqual(
1036
+ * pipe(
1037
+ * Option.some(employee2),
1038
+ * Option.flatMapNullable(employee => employee.company?.address?.street?.name),
1039
+ * ),
1040
+ * Option.none()
1041
+ * )
1042
+ *
1043
+ * @category sequencing
1044
+ * @since 2.0.0
1045
+ */
606
1046
  <A, B>(self: Option<A>, f: (a: A) => B | null | undefined): Option<NonNullable<B>>;
607
1047
  };
608
1048
  /**
@@ -615,7 +1055,15 @@ export declare const flatten: <A>(self: Option<Option<A>>) => Option<A>;
615
1055
  * @since 2.0.0
616
1056
  */
617
1057
  export declare const zipRight: {
1058
+ /**
1059
+ * @category zipping
1060
+ * @since 2.0.0
1061
+ */
618
1062
  <B>(that: Option<B>): <_>(self: Option<_>) => Option<B>;
1063
+ /**
1064
+ * @category zipping
1065
+ * @since 2.0.0
1066
+ */
619
1067
  <X, B>(self: Option<X>, that: Option<B>): Option<B>;
620
1068
  };
621
1069
  /**
@@ -623,7 +1071,15 @@ export declare const zipRight: {
623
1071
  * @since 2.0.0
624
1072
  */
625
1073
  export declare const composeK: {
1074
+ /**
1075
+ * @category sequencing
1076
+ * @since 2.0.0
1077
+ */
626
1078
  <B, C>(bfc: (b: B) => Option<C>): <A>(afb: (a: A) => Option<B>) => (a: A) => Option<C>;
1079
+ /**
1080
+ * @category sequencing
1081
+ * @since 2.0.0
1082
+ */
627
1083
  <A, B, C>(afb: (a: A) => Option<B>, bfc: (b: B) => Option<C>): (a: A) => Option<C>;
628
1084
  };
629
1085
  /**
@@ -638,7 +1094,29 @@ export declare const composeK: {
638
1094
  * @since 2.0.0
639
1095
  */
640
1096
  export declare const zipLeft: {
1097
+ /**
1098
+ * Sequences the specified `that` `Option` but ignores its value.
1099
+ *
1100
+ * It is useful when we want to chain multiple operations, but only care about the result of `self`.
1101
+ *
1102
+ * @param that - The `Option` that will be ignored in the chain and discarded
1103
+ * @param self - The `Option` we care about
1104
+ *
1105
+ * @category zipping
1106
+ * @since 2.0.0
1107
+ */
641
1108
  <_>(that: Option<_>): <A>(self: Option<A>) => Option<A>;
1109
+ /**
1110
+ * Sequences the specified `that` `Option` but ignores its value.
1111
+ *
1112
+ * It is useful when we want to chain multiple operations, but only care about the result of `self`.
1113
+ *
1114
+ * @param that - The `Option` that will be ignored in the chain and discarded
1115
+ * @param self - The `Option` we care about
1116
+ *
1117
+ * @category zipping
1118
+ * @since 2.0.0
1119
+ */
642
1120
  <A, X>(self: Option<A>, that: Option<X>): Option<A>;
643
1121
  };
644
1122
  /**
@@ -663,7 +1141,49 @@ export declare const zipLeft: {
663
1141
  * @since 2.0.0
664
1142
  */
665
1143
  export declare const tap: {
1144
+ /**
1145
+ * Applies the provided function `f` to the value of the `Option` if it is `Some` and returns the original `Option`
1146
+ * unless `f` returns `None`, in which case it returns `None`.
1147
+ *
1148
+ * This function is useful for performing additional computations on the value of the input `Option` without affecting its value.
1149
+ *
1150
+ * @param f - Function to apply to the value of the `Option` if it is `Some`
1151
+ * @param self - The `Option` to apply the function to
1152
+ *
1153
+ * @example
1154
+ * import { Option } from "effect"
1155
+ *
1156
+ * const getInteger = (n: number) => Number.isInteger(n) ? Option.some(n) : Option.none()
1157
+ *
1158
+ * assert.deepStrictEqual(Option.tap(Option.none(), getInteger), Option.none())
1159
+ * assert.deepStrictEqual(Option.tap(Option.some(1), getInteger), Option.some(1))
1160
+ * assert.deepStrictEqual(Option.tap(Option.some(1.14), getInteger), Option.none())
1161
+ *
1162
+ * @category sequencing
1163
+ * @since 2.0.0
1164
+ */
666
1165
  <A, X>(f: (a: A) => Option<X>): (self: Option<A>) => Option<A>;
1166
+ /**
1167
+ * Applies the provided function `f` to the value of the `Option` if it is `Some` and returns the original `Option`
1168
+ * unless `f` returns `None`, in which case it returns `None`.
1169
+ *
1170
+ * This function is useful for performing additional computations on the value of the input `Option` without affecting its value.
1171
+ *
1172
+ * @param f - Function to apply to the value of the `Option` if it is `Some`
1173
+ * @param self - The `Option` to apply the function to
1174
+ *
1175
+ * @example
1176
+ * import { Option } from "effect"
1177
+ *
1178
+ * const getInteger = (n: number) => Number.isInteger(n) ? Option.some(n) : Option.none()
1179
+ *
1180
+ * assert.deepStrictEqual(Option.tap(Option.none(), getInteger), Option.none())
1181
+ * assert.deepStrictEqual(Option.tap(Option.some(1), getInteger), Option.some(1))
1182
+ * assert.deepStrictEqual(Option.tap(Option.some(1.14), getInteger), Option.none())
1183
+ *
1184
+ * @category sequencing
1185
+ * @since 2.0.0
1186
+ */
667
1187
  <A, X>(self: Option<A>, f: (a: A) => Option<X>): Option<A>;
668
1188
  };
669
1189
  /**
@@ -725,7 +1245,55 @@ export declare const all: <const I extends Iterable<Option<any>> | Record<string
725
1245
  * @since 2.0.0
726
1246
  */
727
1247
  export declare const zipWith: {
1248
+ /**
1249
+ * Zips two `Option` values together using a provided function, returning a new `Option` of the result.
1250
+ *
1251
+ * @param self - The left-hand side of the zip operation
1252
+ * @param that - The right-hand side of the zip operation
1253
+ * @param f - The function used to combine the values of the two `Option`s
1254
+ *
1255
+ * @example
1256
+ * import { Option } from "effect"
1257
+ *
1258
+ * type Complex = [real: number, imaginary: number]
1259
+ *
1260
+ * const complex = (real: number, imaginary: number): Complex => [real, imaginary]
1261
+ *
1262
+ * assert.deepStrictEqual(Option.zipWith(Option.none(), Option.none(), complex), Option.none())
1263
+ * assert.deepStrictEqual(Option.zipWith(Option.some(1), Option.none(), complex), Option.none())
1264
+ * assert.deepStrictEqual(Option.zipWith(Option.none(), Option.some(1), complex), Option.none())
1265
+ * assert.deepStrictEqual(Option.zipWith(Option.some(1), Option.some(2), complex), Option.some([1, 2]))
1266
+ *
1267
+ * assert.deepStrictEqual(Option.zipWith(Option.some(1), complex)(Option.some(2)), Option.some([2, 1]))
1268
+ *
1269
+ * @category zipping
1270
+ * @since 2.0.0
1271
+ */
728
1272
  <B, A, C>(that: Option<B>, f: (a: A, b: B) => C): (self: Option<A>) => Option<C>;
1273
+ /**
1274
+ * Zips two `Option` values together using a provided function, returning a new `Option` of the result.
1275
+ *
1276
+ * @param self - The left-hand side of the zip operation
1277
+ * @param that - The right-hand side of the zip operation
1278
+ * @param f - The function used to combine the values of the two `Option`s
1279
+ *
1280
+ * @example
1281
+ * import { Option } from "effect"
1282
+ *
1283
+ * type Complex = [real: number, imaginary: number]
1284
+ *
1285
+ * const complex = (real: number, imaginary: number): Complex => [real, imaginary]
1286
+ *
1287
+ * assert.deepStrictEqual(Option.zipWith(Option.none(), Option.none(), complex), Option.none())
1288
+ * assert.deepStrictEqual(Option.zipWith(Option.some(1), Option.none(), complex), Option.none())
1289
+ * assert.deepStrictEqual(Option.zipWith(Option.none(), Option.some(1), complex), Option.none())
1290
+ * assert.deepStrictEqual(Option.zipWith(Option.some(1), Option.some(2), complex), Option.some([1, 2]))
1291
+ *
1292
+ * assert.deepStrictEqual(Option.zipWith(Option.some(1), complex)(Option.some(2)), Option.some([2, 1]))
1293
+ *
1294
+ * @category zipping
1295
+ * @since 2.0.0
1296
+ */
729
1297
  <A, B, C>(self: Option<A>, that: Option<B>, f: (a: A, b: B) => C): Option<C>;
730
1298
  };
731
1299
  /**
@@ -733,7 +1301,15 @@ export declare const zipWith: {
733
1301
  * @since 2.0.0
734
1302
  */
735
1303
  export declare const ap: {
1304
+ /**
1305
+ * @category combining
1306
+ * @since 2.0.0
1307
+ */
736
1308
  <A>(that: Option<A>): <B>(self: Option<(a: A) => B>) => Option<B>;
1309
+ /**
1310
+ * @category combining
1311
+ * @since 2.0.0
1312
+ */
737
1313
  <A, B>(self: Option<(a: A) => B>, that: Option<A>): Option<B>;
738
1314
  };
739
1315
  /**
@@ -753,7 +1329,39 @@ export declare const ap: {
753
1329
  * @since 2.0.0
754
1330
  */
755
1331
  export declare const reduceCompact: {
1332
+ /**
1333
+ * Reduces an `Iterable` of `Option<A>` to a single value of type `B`, elements that are `None` are ignored.
1334
+ *
1335
+ * @param self - The Iterable of `Option<A>` to be reduced.
1336
+ * @param b - The initial value of the accumulator.
1337
+ * @param f - The reducing function that takes the current accumulator value and the unwrapped value of an `Option<A>`.
1338
+ *
1339
+ * @example
1340
+ * import { pipe, Option } from "effect"
1341
+ *
1342
+ * const iterable = [Option.some(1), Option.none(), Option.some(2), Option.none()]
1343
+ * assert.deepStrictEqual(pipe(iterable, Option.reduceCompact(0, (b, a) => b + a)), 3)
1344
+ *
1345
+ * @category folding
1346
+ * @since 2.0.0
1347
+ */
756
1348
  <B, A>(b: B, f: (b: B, a: A) => B): (self: Iterable<Option<A>>) => B;
1349
+ /**
1350
+ * Reduces an `Iterable` of `Option<A>` to a single value of type `B`, elements that are `None` are ignored.
1351
+ *
1352
+ * @param self - The Iterable of `Option<A>` to be reduced.
1353
+ * @param b - The initial value of the accumulator.
1354
+ * @param f - The reducing function that takes the current accumulator value and the unwrapped value of an `Option<A>`.
1355
+ *
1356
+ * @example
1357
+ * import { pipe, Option } from "effect"
1358
+ *
1359
+ * const iterable = [Option.some(1), Option.none(), Option.some(2), Option.none()]
1360
+ * assert.deepStrictEqual(pipe(iterable, Option.reduceCompact(0, (b, a) => b + a)), 3)
1361
+ *
1362
+ * @category folding
1363
+ * @since 2.0.0
1364
+ */
757
1365
  <A, B>(self: Iterable<Option<A>>, b: B, f: (b: B, a: A) => B): B;
758
1366
  };
759
1367
  /**
@@ -778,7 +1386,15 @@ export declare const toArray: <A>(self: Option<A>) => Array<A>;
778
1386
  * @since 2.0.0
779
1387
  */
780
1388
  export declare const partitionMap: {
1389
+ /**
1390
+ * @category filtering
1391
+ * @since 2.0.0
1392
+ */
781
1393
  <A, B, C>(f: (a: A) => Either<C, B>): (self: Option<A>) => [left: Option<B>, right: Option<C>];
1394
+ /**
1395
+ * @category filtering
1396
+ * @since 2.0.0
1397
+ */
782
1398
  <A, B, C>(self: Option<A>, f: (a: A) => Either<C, B>): [left: Option<B>, right: Option<C>];
783
1399
  };
784
1400
  /**
@@ -802,7 +1418,47 @@ export declare const partitionMap: {
802
1418
  * @since 2.0.0
803
1419
  */
804
1420
  export declare const filterMap: {
1421
+ /**
1422
+ * Maps over the value of an `Option` and filters out `None`s.
1423
+ *
1424
+ * Useful when in addition to filtering you also want to change the type of the `Option`.
1425
+ *
1426
+ * @param self - The `Option` to map over.
1427
+ * @param f - A function to apply to the value of the `Option`.
1428
+ *
1429
+ * @example
1430
+ * import { Option } from "effect"
1431
+ *
1432
+ * const evenNumber = (n: number) => n % 2 === 0 ? Option.some(n) : Option.none()
1433
+ *
1434
+ * assert.deepStrictEqual(Option.filterMap(Option.none(), evenNumber), Option.none())
1435
+ * assert.deepStrictEqual(Option.filterMap(Option.some(3), evenNumber), Option.none())
1436
+ * assert.deepStrictEqual(Option.filterMap(Option.some(2), evenNumber), Option.some(2))
1437
+ *
1438
+ * @category filtering
1439
+ * @since 2.0.0
1440
+ */
805
1441
  <A, B>(f: (a: A) => Option<B>): (self: Option<A>) => Option<B>;
1442
+ /**
1443
+ * Maps over the value of an `Option` and filters out `None`s.
1444
+ *
1445
+ * Useful when in addition to filtering you also want to change the type of the `Option`.
1446
+ *
1447
+ * @param self - The `Option` to map over.
1448
+ * @param f - A function to apply to the value of the `Option`.
1449
+ *
1450
+ * @example
1451
+ * import { Option } from "effect"
1452
+ *
1453
+ * const evenNumber = (n: number) => n % 2 === 0 ? Option.some(n) : Option.none()
1454
+ *
1455
+ * assert.deepStrictEqual(Option.filterMap(Option.none(), evenNumber), Option.none())
1456
+ * assert.deepStrictEqual(Option.filterMap(Option.some(3), evenNumber), Option.none())
1457
+ * assert.deepStrictEqual(Option.filterMap(Option.some(2), evenNumber), Option.some(2))
1458
+ *
1459
+ * @category filtering
1460
+ * @since 2.0.0
1461
+ */
806
1462
  <A, B>(self: Option<A>, f: (a: A) => Option<B>): Option<B>;
807
1463
  };
808
1464
  /**
@@ -834,9 +1490,121 @@ export declare const filterMap: {
834
1490
  * @since 2.0.0
835
1491
  */
836
1492
  export declare const filter: {
1493
+ /**
1494
+ * Filters an `Option` using a predicate. If the predicate is not satisfied or the `Option` is `None` returns `None`.
1495
+ *
1496
+ * If you need to change the type of the `Option` in addition to filtering, see `filterMap`.
1497
+ *
1498
+ * @param predicate - A predicate function to apply to the `Option` value.
1499
+ * @param fb - The `Option` to filter.
1500
+ *
1501
+ * @example
1502
+ * import { Option } from "effect"
1503
+ *
1504
+ * // predicate
1505
+ * const isEven = (n: number) => n % 2 === 0
1506
+ *
1507
+ * assert.deepStrictEqual(Option.filter(Option.none(), isEven), Option.none())
1508
+ * assert.deepStrictEqual(Option.filter(Option.some(3), isEven), Option.none())
1509
+ * assert.deepStrictEqual(Option.filter(Option.some(2), isEven), Option.some(2))
1510
+ *
1511
+ * // refinement
1512
+ * const isNumber = (v: unknown): v is number => typeof v === "number"
1513
+ *
1514
+ * assert.deepStrictEqual(Option.filter(Option.none(), isNumber), Option.none())
1515
+ * assert.deepStrictEqual(Option.filter(Option.some('hello'), isNumber), Option.none())
1516
+ * assert.deepStrictEqual(Option.filter(Option.some(2), isNumber), Option.some(2))
1517
+ *
1518
+ * @category filtering
1519
+ * @since 2.0.0
1520
+ */
837
1521
  <A, B extends A>(refinement: Refinement<NoInfer<A>, B>): (self: Option<A>) => Option<B>;
1522
+ /**
1523
+ * Filters an `Option` using a predicate. If the predicate is not satisfied or the `Option` is `None` returns `None`.
1524
+ *
1525
+ * If you need to change the type of the `Option` in addition to filtering, see `filterMap`.
1526
+ *
1527
+ * @param predicate - A predicate function to apply to the `Option` value.
1528
+ * @param fb - The `Option` to filter.
1529
+ *
1530
+ * @example
1531
+ * import { Option } from "effect"
1532
+ *
1533
+ * // predicate
1534
+ * const isEven = (n: number) => n % 2 === 0
1535
+ *
1536
+ * assert.deepStrictEqual(Option.filter(Option.none(), isEven), Option.none())
1537
+ * assert.deepStrictEqual(Option.filter(Option.some(3), isEven), Option.none())
1538
+ * assert.deepStrictEqual(Option.filter(Option.some(2), isEven), Option.some(2))
1539
+ *
1540
+ * // refinement
1541
+ * const isNumber = (v: unknown): v is number => typeof v === "number"
1542
+ *
1543
+ * assert.deepStrictEqual(Option.filter(Option.none(), isNumber), Option.none())
1544
+ * assert.deepStrictEqual(Option.filter(Option.some('hello'), isNumber), Option.none())
1545
+ * assert.deepStrictEqual(Option.filter(Option.some(2), isNumber), Option.some(2))
1546
+ *
1547
+ * @category filtering
1548
+ * @since 2.0.0
1549
+ */
838
1550
  <A>(predicate: Predicate<NoInfer<A>>): (self: Option<A>) => Option<A>;
1551
+ /**
1552
+ * Filters an `Option` using a predicate. If the predicate is not satisfied or the `Option` is `None` returns `None`.
1553
+ *
1554
+ * If you need to change the type of the `Option` in addition to filtering, see `filterMap`.
1555
+ *
1556
+ * @param predicate - A predicate function to apply to the `Option` value.
1557
+ * @param fb - The `Option` to filter.
1558
+ *
1559
+ * @example
1560
+ * import { Option } from "effect"
1561
+ *
1562
+ * // predicate
1563
+ * const isEven = (n: number) => n % 2 === 0
1564
+ *
1565
+ * assert.deepStrictEqual(Option.filter(Option.none(), isEven), Option.none())
1566
+ * assert.deepStrictEqual(Option.filter(Option.some(3), isEven), Option.none())
1567
+ * assert.deepStrictEqual(Option.filter(Option.some(2), isEven), Option.some(2))
1568
+ *
1569
+ * // refinement
1570
+ * const isNumber = (v: unknown): v is number => typeof v === "number"
1571
+ *
1572
+ * assert.deepStrictEqual(Option.filter(Option.none(), isNumber), Option.none())
1573
+ * assert.deepStrictEqual(Option.filter(Option.some('hello'), isNumber), Option.none())
1574
+ * assert.deepStrictEqual(Option.filter(Option.some(2), isNumber), Option.some(2))
1575
+ *
1576
+ * @category filtering
1577
+ * @since 2.0.0
1578
+ */
839
1579
  <A, B extends A>(self: Option<A>, refinement: Refinement<A, B>): Option<B>;
1580
+ /**
1581
+ * Filters an `Option` using a predicate. If the predicate is not satisfied or the `Option` is `None` returns `None`.
1582
+ *
1583
+ * If you need to change the type of the `Option` in addition to filtering, see `filterMap`.
1584
+ *
1585
+ * @param predicate - A predicate function to apply to the `Option` value.
1586
+ * @param fb - The `Option` to filter.
1587
+ *
1588
+ * @example
1589
+ * import { Option } from "effect"
1590
+ *
1591
+ * // predicate
1592
+ * const isEven = (n: number) => n % 2 === 0
1593
+ *
1594
+ * assert.deepStrictEqual(Option.filter(Option.none(), isEven), Option.none())
1595
+ * assert.deepStrictEqual(Option.filter(Option.some(3), isEven), Option.none())
1596
+ * assert.deepStrictEqual(Option.filter(Option.some(2), isEven), Option.some(2))
1597
+ *
1598
+ * // refinement
1599
+ * const isNumber = (v: unknown): v is number => typeof v === "number"
1600
+ *
1601
+ * assert.deepStrictEqual(Option.filter(Option.none(), isNumber), Option.none())
1602
+ * assert.deepStrictEqual(Option.filter(Option.some('hello'), isNumber), Option.none())
1603
+ * assert.deepStrictEqual(Option.filter(Option.some(2), isNumber), Option.some(2))
1604
+ *
1605
+ * @category filtering
1606
+ * @since 2.0.0
1607
+ */
840
1608
  <A>(self: Option<A>, predicate: Predicate<A>): Option<A>;
841
1609
  };
842
1610
  /**
@@ -906,8 +1674,59 @@ export declare const lift2: <A, B, C>(f: (a: A, b: B) => C) => {
906
1674
  */
907
1675
  export declare const liftPredicate: {
908
1676
  <A, B extends A>(refinement: Refinement<A, B>): (a: A) => Option<B>;
1677
+ /**
1678
+ * Transforms a `Predicate` function into a `Some` of the input value if the predicate returns `true` or `None`
1679
+ * if the predicate returns `false`.
1680
+ *
1681
+ * @param predicate - A `Predicate` function that takes in a value of type `A` and returns a boolean.
1682
+ *
1683
+ * @example
1684
+ * import { Option } from "effect"
1685
+ *
1686
+ * const getOption = Option.liftPredicate((n: number) => n >= 0)
1687
+ *
1688
+ * assert.deepStrictEqual(getOption(-1), Option.none())
1689
+ * assert.deepStrictEqual(getOption(1), Option.some(1))
1690
+ *
1691
+ * @category lifting
1692
+ * @since 2.0.0
1693
+ */
909
1694
  <B extends A, A = B>(predicate: Predicate<A>): (b: B) => Option<B>;
1695
+ /**
1696
+ * Transforms a `Predicate` function into a `Some` of the input value if the predicate returns `true` or `None`
1697
+ * if the predicate returns `false`.
1698
+ *
1699
+ * @param predicate - A `Predicate` function that takes in a value of type `A` and returns a boolean.
1700
+ *
1701
+ * @example
1702
+ * import { Option } from "effect"
1703
+ *
1704
+ * const getOption = Option.liftPredicate((n: number) => n >= 0)
1705
+ *
1706
+ * assert.deepStrictEqual(getOption(-1), Option.none())
1707
+ * assert.deepStrictEqual(getOption(1), Option.some(1))
1708
+ *
1709
+ * @category lifting
1710
+ * @since 2.0.0
1711
+ */
910
1712
  <A, B extends A>(self: A, refinement: Refinement<A, B>): Option<B>;
1713
+ /**
1714
+ * Transforms a `Predicate` function into a `Some` of the input value if the predicate returns `true` or `None`
1715
+ * if the predicate returns `false`.
1716
+ *
1717
+ * @param predicate - A `Predicate` function that takes in a value of type `A` and returns a boolean.
1718
+ *
1719
+ * @example
1720
+ * import { Option } from "effect"
1721
+ *
1722
+ * const getOption = Option.liftPredicate((n: number) => n >= 0)
1723
+ *
1724
+ * assert.deepStrictEqual(getOption(-1), Option.none())
1725
+ * assert.deepStrictEqual(getOption(1), Option.some(1))
1726
+ *
1727
+ * @category lifting
1728
+ * @since 2.0.0
1729
+ */
911
1730
  <B extends A, A = B>(self: B, predicate: Predicate<A>): Option<B>;
912
1731
  };
913
1732
  /**
@@ -938,7 +1757,19 @@ export declare const containsWith: <A>(isEquivalent: (self: A, that: A) => boole
938
1757
  * @since 2.0.0
939
1758
  */
940
1759
  export declare const contains: {
1760
+ /**
1761
+ * Returns a function that checks if an `Option` contains a given value using the default `Equivalence`.
1762
+ *
1763
+ * @category elements
1764
+ * @since 2.0.0
1765
+ */
941
1766
  <A>(a: A): (self: Option<A>) => boolean;
1767
+ /**
1768
+ * Returns a function that checks if an `Option` contains a given value using the default `Equivalence`.
1769
+ *
1770
+ * @category elements
1771
+ * @since 2.0.0
1772
+ */
942
1773
  <A>(self: Option<A>, a: A): boolean;
943
1774
  };
944
1775
  /**
@@ -959,9 +1790,77 @@ export declare const contains: {
959
1790
  * @since 2.0.0
960
1791
  */
961
1792
  export declare const exists: {
1793
+ /**
1794
+ * Check if a value in an `Option` type meets a certain predicate.
1795
+ *
1796
+ * @param self - The `Option` to check.
1797
+ * @param predicate - The condition to check.
1798
+ *
1799
+ * @example
1800
+ * import { pipe, Option } from "effect"
1801
+ *
1802
+ * const isEven = (n: number) => n % 2 === 0
1803
+ *
1804
+ * assert.deepStrictEqual(pipe(Option.some(2), Option.exists(isEven)), true)
1805
+ * assert.deepStrictEqual(pipe(Option.some(1), Option.exists(isEven)), false)
1806
+ * assert.deepStrictEqual(pipe(Option.none(), Option.exists(isEven)), false)
1807
+ *
1808
+ * @since 2.0.0
1809
+ */
962
1810
  <A, B extends A>(refinement: Refinement<NoInfer<A>, B>): (self: Option<A>) => self is Option<B>;
1811
+ /**
1812
+ * Check if a value in an `Option` type meets a certain predicate.
1813
+ *
1814
+ * @param self - The `Option` to check.
1815
+ * @param predicate - The condition to check.
1816
+ *
1817
+ * @example
1818
+ * import { pipe, Option } from "effect"
1819
+ *
1820
+ * const isEven = (n: number) => n % 2 === 0
1821
+ *
1822
+ * assert.deepStrictEqual(pipe(Option.some(2), Option.exists(isEven)), true)
1823
+ * assert.deepStrictEqual(pipe(Option.some(1), Option.exists(isEven)), false)
1824
+ * assert.deepStrictEqual(pipe(Option.none(), Option.exists(isEven)), false)
1825
+ *
1826
+ * @since 2.0.0
1827
+ */
963
1828
  <A>(predicate: Predicate<NoInfer<A>>): (self: Option<A>) => boolean;
1829
+ /**
1830
+ * Check if a value in an `Option` type meets a certain predicate.
1831
+ *
1832
+ * @param self - The `Option` to check.
1833
+ * @param predicate - The condition to check.
1834
+ *
1835
+ * @example
1836
+ * import { pipe, Option } from "effect"
1837
+ *
1838
+ * const isEven = (n: number) => n % 2 === 0
1839
+ *
1840
+ * assert.deepStrictEqual(pipe(Option.some(2), Option.exists(isEven)), true)
1841
+ * assert.deepStrictEqual(pipe(Option.some(1), Option.exists(isEven)), false)
1842
+ * assert.deepStrictEqual(pipe(Option.none(), Option.exists(isEven)), false)
1843
+ *
1844
+ * @since 2.0.0
1845
+ */
964
1846
  <A, B extends A>(self: Option<A>, refinement: Refinement<A, B>): self is Option<B>;
1847
+ /**
1848
+ * Check if a value in an `Option` type meets a certain predicate.
1849
+ *
1850
+ * @param self - The `Option` to check.
1851
+ * @param predicate - The condition to check.
1852
+ *
1853
+ * @example
1854
+ * import { pipe, Option } from "effect"
1855
+ *
1856
+ * const isEven = (n: number) => n % 2 === 0
1857
+ *
1858
+ * assert.deepStrictEqual(pipe(Option.some(2), Option.exists(isEven)), true)
1859
+ * assert.deepStrictEqual(pipe(Option.some(1), Option.exists(isEven)), false)
1860
+ * assert.deepStrictEqual(pipe(Option.none(), Option.exists(isEven)), false)
1861
+ *
1862
+ * @since 2.0.0
1863
+ */
965
1864
  <A>(self: Option<A>, predicate: Predicate<A>): boolean;
966
1865
  };
967
1866
  /**
@@ -995,9 +1894,69 @@ export declare const exists: {
995
1894
  * @since 2.0.0
996
1895
  */
997
1896
  export declare const bindTo: {
1897
+ /**
1898
+ * The "do simulation" in Effect allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
1899
+ *
1900
+ * Here's how the do simulation works:
1901
+ *
1902
+ * 1. Start the do simulation using the `Do` value
1903
+ * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Option` values
1904
+ * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
1905
+ * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
1906
+ * 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
1907
+ *
1908
+ * @see {@link Do}
1909
+ * @see {@link bind}
1910
+ * @see {@link let_ let}
1911
+ *
1912
+ * @example
1913
+ * import { Option, pipe } from "effect"
1914
+ *
1915
+ * const result = pipe(
1916
+ * Option.Do,
1917
+ * Option.bind("x", () => Option.some(2)),
1918
+ * Option.bind("y", () => Option.some(3)),
1919
+ * Option.let("sum", ({ x, y }) => x + y),
1920
+ * Option.filter(({ x, y }) => x * y > 5)
1921
+ * )
1922
+ * assert.deepStrictEqual(result, Option.some({ x: 2, y: 3, sum: 5 }))
1923
+ *
1924
+ * @category do notation
1925
+ * @since 2.0.0
1926
+ */
998
1927
  <N extends string>(name: N): <A>(self: Option<A>) => Option<{
999
1928
  [K in N]: A;
1000
1929
  }>;
1930
+ /**
1931
+ * The "do simulation" in Effect allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
1932
+ *
1933
+ * Here's how the do simulation works:
1934
+ *
1935
+ * 1. Start the do simulation using the `Do` value
1936
+ * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Option` values
1937
+ * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
1938
+ * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
1939
+ * 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
1940
+ *
1941
+ * @see {@link Do}
1942
+ * @see {@link bind}
1943
+ * @see {@link let_ let}
1944
+ *
1945
+ * @example
1946
+ * import { Option, pipe } from "effect"
1947
+ *
1948
+ * const result = pipe(
1949
+ * Option.Do,
1950
+ * Option.bind("x", () => Option.some(2)),
1951
+ * Option.bind("y", () => Option.some(3)),
1952
+ * Option.let("sum", ({ x, y }) => x + y),
1953
+ * Option.filter(({ x, y }) => x * y > 5)
1954
+ * )
1955
+ * assert.deepStrictEqual(result, Option.some({ x: 2, y: 3, sum: 5 }))
1956
+ *
1957
+ * @category do notation
1958
+ * @since 2.0.0
1959
+ */
1001
1960
  <A, N extends string>(self: Option<A>, name: N): Option<{
1002
1961
  [K in N]: A;
1003
1962
  }>;
@@ -1073,9 +2032,69 @@ let_ as let };
1073
2032
  * @since 2.0.0
1074
2033
  */
1075
2034
  export declare const bind: {
2035
+ /**
2036
+ * The "do simulation" in Effect allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
2037
+ *
2038
+ * Here's how the do simulation works:
2039
+ *
2040
+ * 1. Start the do simulation using the `Do` value
2041
+ * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Option` values
2042
+ * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
2043
+ * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
2044
+ * 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
2045
+ *
2046
+ * @see {@link Do}
2047
+ * @see {@link bindTo}
2048
+ * @see {@link let_ let}
2049
+ *
2050
+ * @example
2051
+ * import { Option, pipe } from "effect"
2052
+ *
2053
+ * const result = pipe(
2054
+ * Option.Do,
2055
+ * Option.bind("x", () => Option.some(2)),
2056
+ * Option.bind("y", () => Option.some(3)),
2057
+ * Option.let("sum", ({ x, y }) => x + y),
2058
+ * Option.filter(({ x, y }) => x * y > 5)
2059
+ * )
2060
+ * assert.deepStrictEqual(result, Option.some({ x: 2, y: 3, sum: 5 }))
2061
+ *
2062
+ * @category do notation
2063
+ * @since 2.0.0
2064
+ */
1076
2065
  <N extends string, A extends object, B>(name: Exclude<N, keyof A>, f: (a: A) => Option<B>): (self: Option<A>) => Option<{
1077
2066
  [K in N | keyof A]: K extends keyof A ? A[K] : B;
1078
2067
  }>;
2068
+ /**
2069
+ * The "do simulation" in Effect allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
2070
+ *
2071
+ * Here's how the do simulation works:
2072
+ *
2073
+ * 1. Start the do simulation using the `Do` value
2074
+ * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Option` values
2075
+ * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
2076
+ * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
2077
+ * 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
2078
+ *
2079
+ * @see {@link Do}
2080
+ * @see {@link bindTo}
2081
+ * @see {@link let_ let}
2082
+ *
2083
+ * @example
2084
+ * import { Option, pipe } from "effect"
2085
+ *
2086
+ * const result = pipe(
2087
+ * Option.Do,
2088
+ * Option.bind("x", () => Option.some(2)),
2089
+ * Option.bind("y", () => Option.some(3)),
2090
+ * Option.let("sum", ({ x, y }) => x + y),
2091
+ * Option.filter(({ x, y }) => x * y > 5)
2092
+ * )
2093
+ * assert.deepStrictEqual(result, Option.some({ x: 2, y: 3, sum: 5 }))
2094
+ *
2095
+ * @category do notation
2096
+ * @since 2.0.0
2097
+ */
1079
2098
  <A extends object, N extends string, B>(self: Option<A>, name: Exclude<N, keyof A>, f: (a: A) => Option<B>): Option<{
1080
2099
  [K in N | keyof A]: K extends keyof A ? A[K] : B;
1081
2100
  }>;