effect 3.1.0 → 3.1.2

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 (278) hide show
  1. package/dist/cjs/Array.js +10 -13
  2. package/dist/cjs/Array.js.map +1 -1
  3. package/dist/cjs/BigDecimal.js +14 -17
  4. package/dist/cjs/BigDecimal.js.map +1 -1
  5. package/dist/cjs/BigInt.js +41 -46
  6. package/dist/cjs/BigInt.js.map +1 -1
  7. package/dist/cjs/Boolean.js +13 -13
  8. package/dist/cjs/Brand.js +2 -2
  9. package/dist/cjs/Chunk.js +3 -3
  10. package/dist/cjs/Context.js +15 -20
  11. package/dist/cjs/Context.js.map +1 -1
  12. package/dist/cjs/Cron.js +3 -6
  13. package/dist/cjs/Cron.js.map +1 -1
  14. package/dist/cjs/Data.js +8 -13
  15. package/dist/cjs/Data.js.map +1 -1
  16. package/dist/cjs/Duration.js +1 -1
  17. package/dist/cjs/Effect.js +77 -9
  18. package/dist/cjs/Effect.js.map +1 -1
  19. package/dist/cjs/Either.js +117 -59
  20. package/dist/cjs/Either.js.map +1 -1
  21. package/dist/cjs/Equal.js +26 -4
  22. package/dist/cjs/Equal.js.map +1 -1
  23. package/dist/cjs/FiberHandle.js.map +1 -1
  24. package/dist/cjs/FiberMap.js.map +1 -1
  25. package/dist/cjs/FiberSet.js.map +1 -1
  26. package/dist/cjs/Function.js +2 -2
  27. package/dist/cjs/Function.js.map +1 -1
  28. package/dist/cjs/Hash.js +29 -12
  29. package/dist/cjs/Hash.js.map +1 -1
  30. package/dist/cjs/Iterable.js +10 -13
  31. package/dist/cjs/Iterable.js.map +1 -1
  32. package/dist/cjs/List.js +2 -2
  33. package/dist/cjs/Metric.js +5 -7
  34. package/dist/cjs/Metric.js.map +1 -1
  35. package/dist/cjs/Number.js +20 -21
  36. package/dist/cjs/Number.js.map +1 -1
  37. package/dist/cjs/Option.js +223 -164
  38. package/dist/cjs/Option.js.map +1 -1
  39. package/dist/cjs/Order.js +1 -2
  40. package/dist/cjs/Order.js.map +1 -1
  41. package/dist/cjs/Ordering.js +2 -2
  42. package/dist/cjs/Predicate.js +9 -12
  43. package/dist/cjs/Predicate.js.map +1 -1
  44. package/dist/cjs/Readable.js.map +1 -1
  45. package/dist/cjs/Record.js +35 -47
  46. package/dist/cjs/Record.js.map +1 -1
  47. package/dist/cjs/RegExp.js +1 -1
  48. package/dist/cjs/Request.js +2 -2
  49. package/dist/cjs/Request.js.map +1 -1
  50. package/dist/cjs/Stream.js +82 -4
  51. package/dist/cjs/Stream.js.map +1 -1
  52. package/dist/cjs/String.js +81 -111
  53. package/dist/cjs/String.js.map +1 -1
  54. package/dist/cjs/Struct.js +13 -19
  55. package/dist/cjs/Struct.js.map +1 -1
  56. package/dist/cjs/Subscribable.js.map +1 -1
  57. package/dist/cjs/Symbol.js +3 -3
  58. package/dist/cjs/TestAnnotation.js.map +1 -1
  59. package/dist/cjs/TestAnnotationMap.js.map +1 -1
  60. package/dist/cjs/TestAnnotations.js.map +1 -1
  61. package/dist/cjs/TestClock.js.map +1 -1
  62. package/dist/cjs/TestLive.js.map +1 -1
  63. package/dist/cjs/TestSized.js.map +1 -1
  64. package/dist/cjs/Trie.js +28 -44
  65. package/dist/cjs/Trie.js.map +1 -1
  66. package/dist/cjs/Utils.js +35 -1
  67. package/dist/cjs/Utils.js.map +1 -1
  68. package/dist/cjs/internal/core-effect.js +4 -11
  69. package/dist/cjs/internal/core-effect.js.map +1 -1
  70. package/dist/cjs/internal/core.js +16 -4
  71. package/dist/cjs/internal/core.js.map +1 -1
  72. package/dist/cjs/internal/doNotation.js +23 -0
  73. package/dist/cjs/internal/doNotation.js.map +1 -0
  74. package/dist/cjs/internal/groupBy.js.map +1 -1
  75. package/dist/cjs/internal/stream.js +3 -7
  76. package/dist/cjs/internal/stream.js.map +1 -1
  77. package/dist/cjs/internal/version.js +1 -1
  78. package/dist/dts/Array.d.ts +10 -13
  79. package/dist/dts/Array.d.ts.map +1 -1
  80. package/dist/dts/BigDecimal.d.ts +14 -17
  81. package/dist/dts/BigDecimal.d.ts.map +1 -1
  82. package/dist/dts/BigInt.d.ts +41 -46
  83. package/dist/dts/BigInt.d.ts.map +1 -1
  84. package/dist/dts/Boolean.d.ts +13 -13
  85. package/dist/dts/Brand.d.ts +3 -3
  86. package/dist/dts/Chunk.d.ts +3 -3
  87. package/dist/dts/Context.d.ts +15 -20
  88. package/dist/dts/Context.d.ts.map +1 -1
  89. package/dist/dts/Cron.d.ts +3 -6
  90. package/dist/dts/Cron.d.ts.map +1 -1
  91. package/dist/dts/Data.d.ts +10 -16
  92. package/dist/dts/Data.d.ts.map +1 -1
  93. package/dist/dts/Duration.d.ts +1 -1
  94. package/dist/dts/Effect.d.ts +120 -26
  95. package/dist/dts/Effect.d.ts.map +1 -1
  96. package/dist/dts/Either.d.ts +155 -64
  97. package/dist/dts/Either.d.ts.map +1 -1
  98. package/dist/dts/Equal.d.ts.map +1 -1
  99. package/dist/dts/FiberHandle.d.ts.map +1 -1
  100. package/dist/dts/FiberMap.d.ts.map +1 -1
  101. package/dist/dts/FiberSet.d.ts.map +1 -1
  102. package/dist/dts/Function.d.ts +4 -2
  103. package/dist/dts/Function.d.ts.map +1 -1
  104. package/dist/dts/Hash.d.ts.map +1 -1
  105. package/dist/dts/HashMap.d.ts +2 -2
  106. package/dist/dts/Iterable.d.ts +10 -13
  107. package/dist/dts/Iterable.d.ts.map +1 -1
  108. package/dist/dts/List.d.ts +2 -2
  109. package/dist/dts/Metric.d.ts +5 -7
  110. package/dist/dts/Metric.d.ts.map +1 -1
  111. package/dist/dts/Number.d.ts +20 -21
  112. package/dist/dts/Number.d.ts.map +1 -1
  113. package/dist/dts/Option.d.ts +245 -155
  114. package/dist/dts/Option.d.ts.map +1 -1
  115. package/dist/dts/Order.d.ts +1 -2
  116. package/dist/dts/Order.d.ts.map +1 -1
  117. package/dist/dts/Ordering.d.ts +2 -2
  118. package/dist/dts/Predicate.d.ts +9 -12
  119. package/dist/dts/Predicate.d.ts.map +1 -1
  120. package/dist/dts/Readable.d.ts.map +1 -1
  121. package/dist/dts/Record.d.ts +35 -47
  122. package/dist/dts/Record.d.ts.map +1 -1
  123. package/dist/dts/RegExp.d.ts +1 -1
  124. package/dist/dts/Request.d.ts +2 -2
  125. package/dist/dts/Request.d.ts.map +1 -1
  126. package/dist/dts/Stream.d.ts +136 -31
  127. package/dist/dts/Stream.d.ts.map +1 -1
  128. package/dist/dts/String.d.ts +81 -111
  129. package/dist/dts/String.d.ts.map +1 -1
  130. package/dist/dts/Struct.d.ts +13 -19
  131. package/dist/dts/Struct.d.ts.map +1 -1
  132. package/dist/dts/Subscribable.d.ts.map +1 -1
  133. package/dist/dts/Symbol.d.ts +3 -3
  134. package/dist/dts/TestAnnotation.d.ts.map +1 -1
  135. package/dist/dts/TestAnnotationMap.d.ts.map +1 -1
  136. package/dist/dts/TestAnnotations.d.ts.map +1 -1
  137. package/dist/dts/TestClock.d.ts +1 -5
  138. package/dist/dts/TestClock.d.ts.map +1 -1
  139. package/dist/dts/TestLive.d.ts.map +1 -1
  140. package/dist/dts/TestSized.d.ts.map +1 -1
  141. package/dist/dts/Trie.d.ts +28 -44
  142. package/dist/dts/Trie.d.ts.map +1 -1
  143. package/dist/dts/Types.d.ts +10 -10
  144. package/dist/dts/Utils.d.ts +19 -0
  145. package/dist/dts/Utils.d.ts.map +1 -1
  146. package/dist/dts/internal/core.d.ts.map +1 -1
  147. package/dist/dts/internal/doNotation.d.ts +2 -0
  148. package/dist/dts/internal/doNotation.d.ts.map +1 -0
  149. package/dist/dts/internal/stream.d.ts.map +1 -1
  150. package/dist/esm/Array.js +10 -13
  151. package/dist/esm/Array.js.map +1 -1
  152. package/dist/esm/BigDecimal.js +14 -17
  153. package/dist/esm/BigDecimal.js.map +1 -1
  154. package/dist/esm/BigInt.js +41 -46
  155. package/dist/esm/BigInt.js.map +1 -1
  156. package/dist/esm/Boolean.js +13 -13
  157. package/dist/esm/Brand.js +2 -2
  158. package/dist/esm/Chunk.js +3 -3
  159. package/dist/esm/Context.js +15 -20
  160. package/dist/esm/Context.js.map +1 -1
  161. package/dist/esm/Cron.js +3 -6
  162. package/dist/esm/Cron.js.map +1 -1
  163. package/dist/esm/Data.js +9 -15
  164. package/dist/esm/Data.js.map +1 -1
  165. package/dist/esm/Duration.js +1 -1
  166. package/dist/esm/Effect.js +101 -11
  167. package/dist/esm/Effect.js.map +1 -1
  168. package/dist/esm/Either.js +141 -61
  169. package/dist/esm/Either.js.map +1 -1
  170. package/dist/esm/Equal.js +26 -4
  171. package/dist/esm/Equal.js.map +1 -1
  172. package/dist/esm/FiberHandle.js.map +1 -1
  173. package/dist/esm/FiberMap.js.map +1 -1
  174. package/dist/esm/FiberSet.js.map +1 -1
  175. package/dist/esm/Function.js +2 -2
  176. package/dist/esm/Function.js.map +1 -1
  177. package/dist/esm/Hash.js +30 -13
  178. package/dist/esm/Hash.js.map +1 -1
  179. package/dist/esm/Iterable.js +10 -13
  180. package/dist/esm/Iterable.js.map +1 -1
  181. package/dist/esm/List.js +2 -2
  182. package/dist/esm/Metric.js +5 -7
  183. package/dist/esm/Metric.js.map +1 -1
  184. package/dist/esm/Number.js +20 -21
  185. package/dist/esm/Number.js.map +1 -1
  186. package/dist/esm/Option.js +249 -164
  187. package/dist/esm/Option.js.map +1 -1
  188. package/dist/esm/Order.js +1 -2
  189. package/dist/esm/Order.js.map +1 -1
  190. package/dist/esm/Ordering.js +2 -2
  191. package/dist/esm/Predicate.js +9 -12
  192. package/dist/esm/Predicate.js.map +1 -1
  193. package/dist/esm/Readable.js.map +1 -1
  194. package/dist/esm/Record.js +35 -47
  195. package/dist/esm/Record.js.map +1 -1
  196. package/dist/esm/RegExp.js +1 -1
  197. package/dist/esm/Request.js +2 -2
  198. package/dist/esm/Request.js.map +1 -1
  199. package/dist/esm/Stream.js +107 -6
  200. package/dist/esm/Stream.js.map +1 -1
  201. package/dist/esm/String.js +81 -111
  202. package/dist/esm/String.js.map +1 -1
  203. package/dist/esm/Struct.js +13 -19
  204. package/dist/esm/Struct.js.map +1 -1
  205. package/dist/esm/Subscribable.js.map +1 -1
  206. package/dist/esm/Symbol.js +3 -3
  207. package/dist/esm/TestAnnotation.js.map +1 -1
  208. package/dist/esm/TestAnnotationMap.js.map +1 -1
  209. package/dist/esm/TestAnnotations.js.map +1 -1
  210. package/dist/esm/TestClock.js.map +1 -1
  211. package/dist/esm/TestLive.js.map +1 -1
  212. package/dist/esm/TestSized.js.map +1 -1
  213. package/dist/esm/Trie.js +28 -44
  214. package/dist/esm/Trie.js.map +1 -1
  215. package/dist/esm/Utils.js +33 -0
  216. package/dist/esm/Utils.js.map +1 -1
  217. package/dist/esm/internal/core-effect.js +4 -11
  218. package/dist/esm/internal/core-effect.js.map +1 -1
  219. package/dist/esm/internal/core.js +16 -4
  220. package/dist/esm/internal/core.js.map +1 -1
  221. package/dist/esm/internal/doNotation.js +14 -0
  222. package/dist/esm/internal/doNotation.js.map +1 -0
  223. package/dist/esm/internal/groupBy.js.map +1 -1
  224. package/dist/esm/internal/stream.js +3 -7
  225. package/dist/esm/internal/stream.js.map +1 -1
  226. package/dist/esm/internal/version.js +1 -1
  227. package/package.json +1 -1
  228. package/src/Array.ts +10 -13
  229. package/src/BigDecimal.ts +14 -17
  230. package/src/BigInt.ts +41 -46
  231. package/src/Boolean.ts +13 -13
  232. package/src/Brand.ts +3 -3
  233. package/src/Chunk.ts +3 -3
  234. package/src/Context.ts +15 -20
  235. package/src/Cron.ts +3 -6
  236. package/src/Data.ts +10 -16
  237. package/src/Duration.ts +1 -1
  238. package/src/Effect.ts +122 -32
  239. package/src/Either.ts +161 -94
  240. package/src/Equal.ts +30 -9
  241. package/src/FiberHandle.ts +1 -1
  242. package/src/FiberMap.ts +1 -1
  243. package/src/FiberSet.ts +1 -1
  244. package/src/Function.ts +4 -2
  245. package/src/Hash.ts +30 -13
  246. package/src/HashMap.ts +2 -2
  247. package/src/Iterable.ts +10 -13
  248. package/src/List.ts +2 -2
  249. package/src/Metric.ts +5 -7
  250. package/src/Number.ts +20 -21
  251. package/src/Option.ts +250 -172
  252. package/src/Order.ts +1 -2
  253. package/src/Ordering.ts +2 -2
  254. package/src/Predicate.ts +9 -12
  255. package/src/Readable.ts +1 -1
  256. package/src/Record.ts +35 -47
  257. package/src/RegExp.ts +1 -1
  258. package/src/Request.ts +3 -3
  259. package/src/Stream.ts +137 -36
  260. package/src/String.ts +81 -111
  261. package/src/Struct.ts +13 -19
  262. package/src/Subscribable.ts +1 -1
  263. package/src/Symbol.ts +3 -3
  264. package/src/TestAnnotation.ts +1 -1
  265. package/src/TestAnnotationMap.ts +1 -1
  266. package/src/TestAnnotations.ts +1 -1
  267. package/src/TestClock.ts +1 -5
  268. package/src/TestLive.ts +1 -1
  269. package/src/TestSized.ts +1 -1
  270. package/src/Trie.ts +28 -44
  271. package/src/Types.ts +10 -10
  272. package/src/Utils.ts +40 -2
  273. package/src/internal/core-effect.ts +29 -45
  274. package/src/internal/core.ts +20 -4
  275. package/src/internal/doNotation.ts +77 -0
  276. package/src/internal/groupBy.ts +16 -16
  277. package/src/internal/stream.ts +34 -58
  278. package/src/internal/version.ts +1 -1
@@ -110,11 +110,11 @@ export declare const some: <A>(value: A) => Option<A>;
110
110
  * @param input - The value to check.
111
111
  *
112
112
  * @example
113
- * import { some, none, isOption } from 'effect/Option'
113
+ * import { Option } from "effect"
114
114
  *
115
- * assert.deepStrictEqual(isOption(some(1)), true)
116
- * assert.deepStrictEqual(isOption(none()), true)
117
- * assert.deepStrictEqual(isOption({}), false)
115
+ * assert.deepStrictEqual(Option.isOption(Option.some(1)), true)
116
+ * assert.deepStrictEqual(Option.isOption(Option.none()), true)
117
+ * assert.deepStrictEqual(Option.isOption({}), false)
118
118
  *
119
119
  * @category guards
120
120
  * @since 2.0.0
@@ -126,10 +126,10 @@ export declare const isOption: (input: unknown) => input is Option<unknown>;
126
126
  * @param self - The `Option` to check.
127
127
  *
128
128
  * @example
129
- * import { some, none, isNone } from 'effect/Option'
129
+ * import { Option } from "effect"
130
130
  *
131
- * assert.deepStrictEqual(isNone(some(1)), false)
132
- * assert.deepStrictEqual(isNone(none()), true)
131
+ * assert.deepStrictEqual(Option.isNone(Option.some(1)), false)
132
+ * assert.deepStrictEqual(Option.isNone(Option.none()), true)
133
133
  *
134
134
  * @category guards
135
135
  * @since 2.0.0
@@ -141,10 +141,10 @@ export declare const isNone: <A>(self: Option<A>) => self is None<A>;
141
141
  * @param self - The `Option` to check.
142
142
  *
143
143
  * @example
144
- * import { some, none, isSome } from 'effect/Option'
144
+ * import { Option } from "effect"
145
145
  *
146
- * assert.deepStrictEqual(isSome(some(1)), true)
147
- * assert.deepStrictEqual(isSome(none()), false)
146
+ * assert.deepStrictEqual(Option.isSome(Option.some(1)), true)
147
+ * assert.deepStrictEqual(Option.isSome(Option.none()), false)
148
148
  *
149
149
  * @category guards
150
150
  * @since 2.0.0
@@ -159,16 +159,15 @@ export declare const isSome: <A>(self: Option<A>) => self is Some<A>;
159
159
  * @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
160
160
  *
161
161
  * @example
162
- * import { some, none, match } from 'effect/Option'
163
- * import { pipe } from "effect/Function"
162
+ * import { pipe, Option } from "effect"
164
163
  *
165
164
  * assert.deepStrictEqual(
166
- * pipe(some(1), match({ onNone: () => 'a none', onSome: (a) => `a some containing ${a}` })),
165
+ * pipe(Option.some(1), Option.match({ onNone: () => 'a none', onSome: (a) => `a some containing ${a}` })),
167
166
  * 'a some containing 1'
168
167
  * )
169
168
  *
170
169
  * assert.deepStrictEqual(
171
- * pipe(none(), match({ onNone: () => 'a none', onSome: (a) => `a some containing ${a}` })),
170
+ * pipe(Option.none(), Option.match({ onNone: () => 'a none', onSome: (a) => `a some containing ${a}` })),
172
171
  * 'a none'
173
172
  * )
174
173
  *
@@ -190,12 +189,12 @@ export declare const match: {
190
189
  * This function ensures that a type guard definition is type-safe.
191
190
  *
192
191
  * @example
193
- * import * as O from "effect/Option"
192
+ * import { Option } from "effect"
194
193
  *
195
- * const parsePositive = (n: number): O.Option<number> =>
196
- * n > 0 ? O.some(n) : O.none()
194
+ * const parsePositive = (n: number): Option.Option<number> =>
195
+ * n > 0 ? Option.some(n) : Option.none()
197
196
  *
198
- * const isPositive = O.toRefinement(parsePositive)
197
+ * const isPositive = Option.toRefinement(parsePositive)
199
198
  *
200
199
  * assert.deepStrictEqual(isPositive(1), true)
201
200
  * assert.deepStrictEqual(isPositive(-1), false)
@@ -211,10 +210,10 @@ export declare const toRefinement: <A, B extends A>(f: (a: A) => Option<B>) => (
211
210
  * @param collection - The `Iterable` to be converted to an `Option`.
212
211
  *
213
212
  * @example
214
- * import { fromIterable, some, none } from 'effect/Option'
213
+ * import { Option } from "effect"
215
214
  *
216
- * assert.deepStrictEqual(fromIterable([1, 2, 3]), some(1))
217
- * assert.deepStrictEqual(fromIterable([]), none())
215
+ * assert.deepStrictEqual(Option.fromIterable([1, 2, 3]), Option.some(1))
216
+ * assert.deepStrictEqual(Option.fromIterable([]), Option.none())
218
217
  *
219
218
  * @category constructors
220
219
  * @since 2.0.0
@@ -226,11 +225,10 @@ export declare const fromIterable: <A>(collection: Iterable<A>) => Option<A>;
226
225
  * Alias of {@link fromEither}.
227
226
  *
228
227
  * @example
229
- * import * as O from "effect/Option"
230
- * import * as E from "effect/Either"
228
+ * import { Option, Either } from "effect"
231
229
  *
232
- * assert.deepStrictEqual(O.getRight(E.right('ok')), O.some('ok'))
233
- * assert.deepStrictEqual(O.getRight(E.left('err')), O.none())
230
+ * assert.deepStrictEqual(Option.getRight(Either.right('ok')), Option.some('ok'))
231
+ * assert.deepStrictEqual(Option.getRight(Either.left('err')), Option.none())
234
232
  *
235
233
  * @category conversions
236
234
  * @since 2.0.0
@@ -240,11 +238,10 @@ export declare const getRight: <R, L>(self: Either<R, L>) => Option<R>;
240
238
  * Converts a `Either` to an `Option` discarding the value.
241
239
  *
242
240
  * @example
243
- * import * as O from "effect/Option"
244
- * import * as E from "effect/Either"
241
+ * import { Option, Either } from "effect"
245
242
  *
246
- * assert.deepStrictEqual(O.getLeft(E.right("ok")), O.none())
247
- * assert.deepStrictEqual(O.getLeft(E.left("a")), O.some("a"))
243
+ * assert.deepStrictEqual(Option.getLeft(Either.right("ok")), Option.none())
244
+ * assert.deepStrictEqual(Option.getLeft(Either.left("a")), Option.some("a"))
248
245
  *
249
246
  * @category conversions
250
247
  * @since 2.0.0
@@ -257,11 +254,10 @@ export declare const getLeft: <R, L>(self: Either<R, L>) => Option<L>;
257
254
  * @param onNone - Function that returns the default value to return if the `Option` is `None`.
258
255
  *
259
256
  * @example
260
- * import { some, none, getOrElse } from 'effect/Option'
261
- * import { pipe } from "effect/Function"
257
+ * import { pipe, Option } from "effect"
262
258
  *
263
- * assert.deepStrictEqual(pipe(some(1), getOrElse(() => 0)), 1)
264
- * assert.deepStrictEqual(pipe(none(), getOrElse(() => 0)), 0)
259
+ * assert.deepStrictEqual(pipe(Option.some(1), Option.getOrElse(() => 0)), 1)
260
+ * assert.deepStrictEqual(pipe(Option.none(), Option.getOrElse(() => 0)), 0)
265
261
  *
266
262
  * @category getters
267
263
  * @since 2.0.0
@@ -277,36 +273,35 @@ export declare const getOrElse: {
277
273
  * @param that - The `Option` to return if `self` is `None`.
278
274
  *
279
275
  * @example
280
- * import * as O from "effect/Option"
281
- * import { pipe } from "effect/Function"
276
+ * import { pipe, Option } from "effect"
282
277
  *
283
278
  * assert.deepStrictEqual(
284
279
  * pipe(
285
- * O.none(),
286
- * O.orElse(() => O.none())
280
+ * Option.none(),
281
+ * Option.orElse(() => Option.none())
287
282
  * ),
288
- * O.none()
283
+ * Option.none()
289
284
  * )
290
285
  * assert.deepStrictEqual(
291
286
  * pipe(
292
- * O.some('a'),
293
- * O.orElse(() => O.none())
287
+ * Option.some('a'),
288
+ * Option.orElse(() => Option.none())
294
289
  * ),
295
- * O.some('a')
290
+ * Option.some('a')
296
291
  * )
297
292
  * assert.deepStrictEqual(
298
293
  * pipe(
299
- * O.none(),
300
- * O.orElse(() => O.some('b'))
294
+ * Option.none(),
295
+ * Option.orElse(() => Option.some('b'))
301
296
  * ),
302
- * O.some('b')
297
+ * Option.some('b')
303
298
  * )
304
299
  * assert.deepStrictEqual(
305
300
  * pipe(
306
- * O.some('a'),
307
- * O.orElse(() => O.some('b'))
301
+ * Option.some('a'),
302
+ * Option.orElse(() => Option.some('b'))
308
303
  * ),
309
- * O.some('a')
304
+ * Option.some('a')
310
305
  * )
311
306
  *
312
307
  * @category error handling
@@ -323,22 +318,21 @@ export declare const orElse: {
323
318
  * @param onNone - Function that returns the default value to return if the `Option` is `None`.
324
319
  *
325
320
  * @example
326
- * import * as O from "effect/Option"
327
- * import { pipe } from "effect/Function"
321
+ * import { pipe, Option } from "effect"
328
322
  *
329
323
  * assert.deepStrictEqual(
330
324
  * pipe(
331
- * O.none(),
332
- * O.orElseSome(() => 'b')
325
+ * Option.none(),
326
+ * Option.orElseSome(() => 'b')
333
327
  * ),
334
- * O.some('b')
328
+ * Option.some('b')
335
329
  * )
336
330
  * assert.deepStrictEqual(
337
331
  * pipe(
338
- * O.some('a'),
339
- * O.orElseSome(() => 'b')
332
+ * Option.some('a'),
333
+ * Option.orElseSome(() => 'b')
340
334
  * ),
341
- * O.some('a')
335
+ * Option.some('a')
342
336
  * )
343
337
  *
344
338
  * @category error handling
@@ -370,9 +364,9 @@ export declare const orElseEither: {
370
364
  * @param collection - An iterable collection of `Option` to be searched.
371
365
  *
372
366
  * @example
373
- * import * as O from "effect/Option"
367
+ * import { Option } from "effect"
374
368
  *
375
- * assert.deepStrictEqual(O.firstSomeOf([O.none(), O.some(1), O.some(2)]), O.some(1))
369
+ * assert.deepStrictEqual(Option.firstSomeOf([Option.none(), Option.some(1), Option.some(2)]), Option.some(1))
376
370
  *
377
371
  * @category error handling
378
372
  * @since 2.0.0
@@ -385,11 +379,11 @@ export declare const firstSomeOf: <A>(collection: Iterable<Option<A>>) => Option
385
379
  * @param nullableValue - The nullable value to be converted to an `Option`.
386
380
  *
387
381
  * @example
388
- * import * as O from "effect/Option"
382
+ * import { Option } from "effect"
389
383
  *
390
- * assert.deepStrictEqual(O.fromNullable(undefined), O.none())
391
- * assert.deepStrictEqual(O.fromNullable(null), O.none())
392
- * assert.deepStrictEqual(O.fromNullable(1), O.some(1))
384
+ * assert.deepStrictEqual(Option.fromNullable(undefined), Option.none())
385
+ * assert.deepStrictEqual(Option.fromNullable(null), Option.none())
386
+ * assert.deepStrictEqual(Option.fromNullable(1), Option.some(1))
393
387
  *
394
388
  * @category conversions
395
389
  * @since 2.0.0
@@ -399,17 +393,17 @@ export declare const fromNullable: <A>(nullableValue: A) => Option<NonNullable<A
399
393
  * This API is useful for lifting a function that returns `null` or `undefined` into the `Option` context.
400
394
  *
401
395
  * @example
402
- * import * as O from "effect/Option"
396
+ * import { Option } from "effect"
403
397
  *
404
398
  * const parse = (s: string): number | undefined => {
405
399
  * const n = parseFloat(s)
406
400
  * return isNaN(n) ? undefined : n
407
401
  * }
408
402
  *
409
- * const parseOption = O.liftNullable(parse)
403
+ * const parseOption = Option.liftNullable(parse)
410
404
  *
411
- * assert.deepStrictEqual(parseOption('1'), O.some(1))
412
- * assert.deepStrictEqual(parseOption('not a number'), O.none())
405
+ * assert.deepStrictEqual(parseOption('1'), Option.some(1))
406
+ * assert.deepStrictEqual(parseOption('not a number'), Option.none())
413
407
  *
414
408
  * @category conversions
415
409
  * @since 2.0.0
@@ -421,10 +415,10 @@ export declare const liftNullable: <A extends readonly unknown[], B>(f: (...a: A
421
415
  * @param self - The `Option` to extract the value from.
422
416
  *
423
417
  * @example
424
- * import * as O from "effect/Option"
418
+ * import { Option } from "effect"
425
419
  *
426
- * assert.deepStrictEqual(O.getOrNull(O.some(1)), 1)
427
- * assert.deepStrictEqual(O.getOrNull(O.none()), null)
420
+ * assert.deepStrictEqual(Option.getOrNull(Option.some(1)), 1)
421
+ * assert.deepStrictEqual(Option.getOrNull(Option.none()), null)
428
422
  *
429
423
  * @category getters
430
424
  * @since 2.0.0
@@ -436,10 +430,10 @@ export declare const getOrNull: <A>(self: Option<A>) => A | null;
436
430
  * @param self - The `Option` to extract the value from.
437
431
  *
438
432
  * @example
439
- * import * as O from "effect/Option"
433
+ * import { Option } from "effect"
440
434
  *
441
- * assert.deepStrictEqual(O.getOrUndefined(O.some(1)), 1)
442
- * assert.deepStrictEqual(O.getOrUndefined(O.none()), undefined)
435
+ * assert.deepStrictEqual(Option.getOrUndefined(Option.some(1)), 1)
436
+ * assert.deepStrictEqual(Option.getOrUndefined(Option.none()), undefined)
443
437
  *
444
438
  * @category getters
445
439
  * @since 2.0.0
@@ -454,12 +448,12 @@ export declare const getOrUndefined: <A>(self: Option<A>) => A | undefined;
454
448
  * @param f - the function that can throw exceptions.
455
449
  *
456
450
  * @example
457
- * import * as O from "effect/Option"
451
+ * import { Option } from "effect"
458
452
  *
459
- * const parse = O.liftThrowable(JSON.parse)
453
+ * const parse = Option.liftThrowable(JSON.parse)
460
454
  *
461
- * assert.deepStrictEqual(parse("1"), O.some(1))
462
- * assert.deepStrictEqual(parse(""), O.none())
455
+ * assert.deepStrictEqual(parse("1"), Option.some(1))
456
+ * assert.deepStrictEqual(parse(""), Option.none())
463
457
  *
464
458
  * @category conversions
465
459
  * @since 2.0.0
@@ -474,13 +468,13 @@ export declare const liftThrowable: <A extends readonly unknown[], B>(f: (...a:
474
468
  * @param onNone - A function that will be called if the `Option` is `None`. It returns the error to be thrown.
475
469
  *
476
470
  * @example
477
- * import * as O from "effect/Option"
471
+ * import { Option } from "effect"
478
472
  *
479
473
  * assert.deepStrictEqual(
480
- * O.getOrThrowWith(O.some(1), () => new Error('Unexpected None')),
474
+ * Option.getOrThrowWith(Option.some(1), () => new Error('Unexpected None')),
481
475
  * 1
482
476
  * )
483
- * assert.throws(() => O.getOrThrowWith(O.none(), () => new Error('Unexpected None')))
477
+ * assert.throws(() => Option.getOrThrowWith(Option.none(), () => new Error('Unexpected None')))
484
478
  *
485
479
  * @category conversions
486
480
  * @since 2.0.0
@@ -498,10 +492,10 @@ export declare const getOrThrowWith: {
498
492
  * @throws `Error("getOrThrow called on a None")`
499
493
  *
500
494
  * @example
501
- * import * as O from "effect/Option"
495
+ * import { Option } from "effect"
502
496
  *
503
- * assert.deepStrictEqual(O.getOrThrow(O.some(1)), 1)
504
- * assert.throws(() => O.getOrThrow(O.none()))
497
+ * assert.deepStrictEqual(Option.getOrThrow(Option.some(1)), 1)
498
+ * assert.throws(() => Option.getOrThrow(Option.none()))
505
499
  *
506
500
  * @category conversions
507
501
  * @since 2.0.0
@@ -574,8 +568,7 @@ export declare const andThen: {
574
568
  * This is `flatMap` + `fromNullable`, useful when working with optional values.
575
569
  *
576
570
  * @example
577
- * import { some, none, flatMapNullable } from 'effect/Option'
578
- * import { pipe } from "effect/Function"
571
+ * import { pipe, Option } from "effect"
579
572
  *
580
573
  * interface Employee {
581
574
  * company?: {
@@ -591,20 +584,20 @@ export declare const andThen: {
591
584
  *
592
585
  * assert.deepStrictEqual(
593
586
  * pipe(
594
- * some(employee1),
595
- * flatMapNullable(employee => employee.company?.address?.street?.name),
587
+ * Option.some(employee1),
588
+ * Option.flatMapNullable(employee => employee.company?.address?.street?.name),
596
589
  * ),
597
- * some('high street')
590
+ * Option.some('high street')
598
591
  * )
599
592
  *
600
593
  * const employee2: Employee = { company: { address: { street: {} } } }
601
594
  *
602
595
  * assert.deepStrictEqual(
603
596
  * pipe(
604
- * some(employee2),
605
- * flatMapNullable(employee => employee.company?.address?.street?.name),
597
+ * Option.some(employee2),
598
+ * Option.flatMapNullable(employee => employee.company?.address?.street?.name),
606
599
  * ),
607
- * none()
600
+ * Option.none()
608
601
  * )
609
602
  *
610
603
  * @category sequencing
@@ -660,13 +653,13 @@ export declare const zipLeft: {
660
653
  * @param self - The `Option` to apply the function to
661
654
  *
662
655
  * @example
663
- * import * as O from "effect/Option"
656
+ * import { Option } from "effect"
664
657
  *
665
- * const getInteger = (n: number) => Number.isInteger(n) ? O.some(n) : O.none()
658
+ * const getInteger = (n: number) => Number.isInteger(n) ? Option.some(n) : Option.none()
666
659
  *
667
- * assert.deepStrictEqual(O.tap(O.none(), getInteger), O.none())
668
- * assert.deepStrictEqual(O.tap(O.some(1), getInteger), O.some(1))
669
- * assert.deepStrictEqual(O.tap(O.some(1.14), getInteger), O.none())
660
+ * assert.deepStrictEqual(Option.tap(Option.none(), getInteger), Option.none())
661
+ * assert.deepStrictEqual(Option.tap(Option.some(1), getInteger), Option.some(1))
662
+ * assert.deepStrictEqual(Option.tap(Option.some(1.14), getInteger), Option.none())
670
663
  *
671
664
  * @category sequencing
672
665
  * @since 2.0.0
@@ -695,11 +688,11 @@ export declare const productMany: <A>(self: Option<A>, collection: Iterable<Opti
695
688
  * @param fields - the struct of `Option`s to be sequenced.
696
689
  *
697
690
  * @example
698
- * import * as O from "effect/Option"
691
+ * import { Option } from "effect"
699
692
  *
700
- * assert.deepStrictEqual(O.all([O.some(1), O.some(2)]), O.some([1, 2]))
701
- * assert.deepStrictEqual(O.all({ a: O.some(1), b: O.some("hello") }), O.some({ a: 1, b: "hello" }))
702
- * assert.deepStrictEqual(O.all({ a: O.some(1), b: O.none() }), O.none())
693
+ * assert.deepStrictEqual(Option.all([Option.some(1), Option.some(2)]), Option.some([1, 2]))
694
+ * assert.deepStrictEqual(Option.all({ a: Option.some(1), b: Option.some("hello") }), Option.some({ a: 1, b: "hello" }))
695
+ * assert.deepStrictEqual(Option.all({ a: Option.some(1), b: Option.none() }), Option.none())
703
696
  *
704
697
  * @category combining
705
698
  * @since 2.0.0
@@ -717,18 +710,18 @@ export declare const all: <const I extends Iterable<Option<any>> | Record<string
717
710
  * @param f - The function used to combine the values of the two `Option`s
718
711
  *
719
712
  * @example
720
- * import * as O from "effect/Option"
713
+ * import { Option } from "effect"
721
714
  *
722
715
  * type Complex = [real: number, imaginary: number]
723
716
  *
724
717
  * const complex = (real: number, imaginary: number): Complex => [real, imaginary]
725
718
  *
726
- * assert.deepStrictEqual(O.zipWith(O.none(), O.none(), complex), O.none())
727
- * assert.deepStrictEqual(O.zipWith(O.some(1), O.none(), complex), O.none())
728
- * assert.deepStrictEqual(O.zipWith(O.none(), O.some(1), complex), O.none())
729
- * assert.deepStrictEqual(O.zipWith(O.some(1), O.some(2), complex), O.some([1, 2]))
719
+ * assert.deepStrictEqual(Option.zipWith(Option.none(), Option.none(), complex), Option.none())
720
+ * assert.deepStrictEqual(Option.zipWith(Option.some(1), Option.none(), complex), Option.none())
721
+ * assert.deepStrictEqual(Option.zipWith(Option.none(), Option.some(1), complex), Option.none())
722
+ * assert.deepStrictEqual(Option.zipWith(Option.some(1), Option.some(2), complex), Option.some([1, 2]))
730
723
  *
731
- * assert.deepStrictEqual(O.zipWith(O.some(1), complex)(O.some(2)), O.some([2, 1]))
724
+ * assert.deepStrictEqual(Option.zipWith(Option.some(1), complex)(Option.some(2)), Option.some([2, 1]))
732
725
  *
733
726
  * @category zipping
734
727
  * @since 2.0.0
@@ -753,11 +746,10 @@ export declare const ap: {
753
746
  * @param f - The reducing function that takes the current accumulator value and the unwrapped value of an `Option<A>`.
754
747
  *
755
748
  * @example
756
- * import { some, none, reduceCompact } from 'effect/Option'
757
- * import { pipe } from "effect/Function"
749
+ * import { pipe, Option } from "effect"
758
750
  *
759
- * const iterable = [some(1), none(), some(2), none()]
760
- * assert.deepStrictEqual(pipe(iterable, reduceCompact(0, (b, a) => b + a)), 3)
751
+ * const iterable = [Option.some(1), Option.none(), Option.some(2), Option.none()]
752
+ * assert.deepStrictEqual(pipe(iterable, Option.reduceCompact(0, (b, a) => b + a)), 3)
761
753
  *
762
754
  * @category folding
763
755
  * @since 2.0.0
@@ -774,10 +766,10 @@ export declare const reduceCompact: {
774
766
  * @param self - The `Option` to convert to an array.
775
767
  *
776
768
  * @example
777
- * import * as O from "effect/Option"
769
+ * import { Option } from "effect"
778
770
  *
779
- * assert.deepStrictEqual(O.toArray(O.some(1)), [1])
780
- * assert.deepStrictEqual(O.toArray(O.none()), [])
771
+ * assert.deepStrictEqual(Option.toArray(Option.some(1)), [1])
772
+ * assert.deepStrictEqual(Option.toArray(Option.none()), [])
781
773
  *
782
774
  * @category conversions
783
775
  * @since 2.0.0
@@ -800,13 +792,13 @@ export declare const partitionMap: {
800
792
  * @param f - A function to apply to the value of the `Option`.
801
793
  *
802
794
  * @example
803
- * import * as O from "effect/Option"
795
+ * import { Option } from "effect"
804
796
  *
805
- * const evenNumber = (n: number) => n % 2 === 0 ? O.some(n) : O.none()
797
+ * const evenNumber = (n: number) => n % 2 === 0 ? Option.some(n) : Option.none()
806
798
  *
807
- * assert.deepStrictEqual(O.filterMap(O.none(), evenNumber), O.none())
808
- * assert.deepStrictEqual(O.filterMap(O.some(3), evenNumber), O.none())
809
- * assert.deepStrictEqual(O.filterMap(O.some(2), evenNumber), O.some(2))
799
+ * assert.deepStrictEqual(Option.filterMap(Option.none(), evenNumber), Option.none())
800
+ * assert.deepStrictEqual(Option.filterMap(Option.some(3), evenNumber), Option.none())
801
+ * assert.deepStrictEqual(Option.filterMap(Option.some(2), evenNumber), Option.some(2))
810
802
  *
811
803
  * @category filtering
812
804
  * @since 2.0.0
@@ -824,21 +816,21 @@ export declare const filterMap: {
824
816
  * @param fb - The `Option` to filter.
825
817
  *
826
818
  * @example
827
- * import * as O from "effect/Option"
819
+ * import { Option } from "effect"
828
820
  *
829
821
  * // predicate
830
822
  * const isEven = (n: number) => n % 2 === 0
831
823
  *
832
- * assert.deepStrictEqual(O.filter(O.none(), isEven), O.none())
833
- * assert.deepStrictEqual(O.filter(O.some(3), isEven), O.none())
834
- * assert.deepStrictEqual(O.filter(O.some(2), isEven), O.some(2))
824
+ * assert.deepStrictEqual(Option.filter(Option.none(), isEven), Option.none())
825
+ * assert.deepStrictEqual(Option.filter(Option.some(3), isEven), Option.none())
826
+ * assert.deepStrictEqual(Option.filter(Option.some(2), isEven), Option.some(2))
835
827
  *
836
828
  * // refinement
837
829
  * const isNumber = (v: unknown): v is number => typeof v === "number"
838
830
  *
839
- * assert.deepStrictEqual(O.filter(O.none(), isNumber), O.none())
840
- * assert.deepStrictEqual(O.filter(O.some('hello'), isNumber), O.none())
841
- * assert.deepStrictEqual(O.filter(O.some(2), isNumber), O.some(2))
831
+ * assert.deepStrictEqual(Option.filter(Option.none(), isNumber), Option.none())
832
+ * assert.deepStrictEqual(Option.filter(Option.some('hello'), isNumber), Option.none())
833
+ * assert.deepStrictEqual(Option.filter(Option.some(2), isNumber), Option.some(2))
842
834
  *
843
835
  * @category filtering
844
836
  * @since 2.0.0
@@ -851,15 +843,14 @@ export declare const filter: {
851
843
  };
852
844
  /**
853
845
  * @example
854
- * import { none, some, getEquivalence } from 'effect/Option'
855
- * import * as N from 'effect/Number'
846
+ * import { Option, Number } from "effect"
856
847
  *
857
- * const isEquivalent = getEquivalence(N.Equivalence)
858
- * assert.deepStrictEqual(isEquivalent(none(), none()), true)
859
- * assert.deepStrictEqual(isEquivalent(none(), some(1)), false)
860
- * assert.deepStrictEqual(isEquivalent(some(1), none()), false)
861
- * assert.deepStrictEqual(isEquivalent(some(1), some(2)), false)
862
- * assert.deepStrictEqual(isEquivalent(some(1), some(1)), true)
848
+ * const isEquivalent = Option.getEquivalence(Number.Equivalence)
849
+ * assert.deepStrictEqual(isEquivalent(Option.none(), Option.none()), true)
850
+ * assert.deepStrictEqual(isEquivalent(Option.none(), Option.some(1)), false)
851
+ * assert.deepStrictEqual(isEquivalent(Option.some(1), Option.none()), false)
852
+ * assert.deepStrictEqual(isEquivalent(Option.some(1), Option.some(2)), false)
853
+ * assert.deepStrictEqual(isEquivalent(Option.some(1), Option.some(1)), true)
863
854
  *
864
855
  * @category equivalence
865
856
  * @since 2.0.0
@@ -873,16 +864,14 @@ export declare const getEquivalence: <A>(isEquivalent: Equivalence.Equivalence<A
873
864
  * `None` is considered to be less than any `Some` value.
874
865
  *
875
866
  * @example
876
- * import { none, some, getOrder } from 'effect/Option'
877
- * import * as N from 'effect/Number'
878
- * import { pipe } from "effect/Function"
867
+ * import { pipe, Option, Number } from "effect"
879
868
  *
880
- * const O = getOrder(N.Order)
881
- * assert.deepStrictEqual(O(none(), none()), 0)
882
- * assert.deepStrictEqual(O(none(), some(1)), -1)
883
- * assert.deepStrictEqual(O(some(1), none()), 1)
884
- * assert.deepStrictEqual(O(some(1), some(2)), -1)
885
- * assert.deepStrictEqual(O(some(1), some(1)), 0)
869
+ * const O = Option.getOrder(Number.Order)
870
+ * assert.deepStrictEqual(O(Option.none(), Option.none()), 0)
871
+ * assert.deepStrictEqual(O(Option.none(), Option.some(1)), -1)
872
+ * assert.deepStrictEqual(O(Option.some(1), Option.none()), 1)
873
+ * assert.deepStrictEqual(O(Option.some(1), Option.some(2)), -1)
874
+ * assert.deepStrictEqual(O(Option.some(1), Option.some(1)), 0)
886
875
  *
887
876
  * @category sorting
888
877
  * @since 2.0.0
@@ -907,12 +896,12 @@ export declare const lift2: <A, B, C>(f: (a: A, b: B) => C) => {
907
896
  * @param predicate - A `Predicate` function that takes in a value of type `A` and returns a boolean.
908
897
  *
909
898
  * @example
910
- * import * as O from "effect/Option"
899
+ * import { Option } from "effect"
911
900
  *
912
- * const getOption = O.liftPredicate((n: number) => n >= 0)
901
+ * const getOption = Option.liftPredicate((n: number) => n >= 0)
913
902
  *
914
- * assert.deepStrictEqual(getOption(-1), O.none())
915
- * assert.deepStrictEqual(getOption(1), O.some(1))
903
+ * assert.deepStrictEqual(getOption(-1), Option.none())
904
+ * assert.deepStrictEqual(getOption(1), Option.some(1))
916
905
  *
917
906
  * @category lifting
918
907
  * @since 2.0.0
@@ -929,13 +918,11 @@ export declare const liftPredicate: {
929
918
  * @param a - The value to compare against the `Option`.
930
919
  *
931
920
  * @example
932
- * import { some, none, containsWith } from 'effect/Option'
933
- * import { Equivalence } from 'effect/Number'
934
- * import { pipe } from "effect/Function"
921
+ * import { pipe, Option, Number } from "effect"
935
922
  *
936
- * assert.deepStrictEqual(pipe(some(2), containsWith(Equivalence)(2)), true)
937
- * assert.deepStrictEqual(pipe(some(1), containsWith(Equivalence)(2)), false)
938
- * assert.deepStrictEqual(pipe(none(), containsWith(Equivalence)(2)), false)
923
+ * assert.deepStrictEqual(pipe(Option.some(2), Option.containsWith(Number.Equivalence)(2)), true)
924
+ * assert.deepStrictEqual(pipe(Option.some(1), Option.containsWith(Number.Equivalence)(2)), false)
925
+ * assert.deepStrictEqual(pipe(Option.none(), Option.containsWith(Number.Equivalence)(2)), false)
939
926
  *
940
927
  * @category elements
941
928
  * @since 2.0.0
@@ -961,14 +948,13 @@ export declare const contains: {
961
948
  * @param predicate - The condition to check.
962
949
  *
963
950
  * @example
964
- * import { some, none, exists } from 'effect/Option'
965
- * import { pipe } from "effect/Function"
951
+ * import { pipe, Option } from "effect"
966
952
  *
967
953
  * const isEven = (n: number) => n % 2 === 0
968
954
  *
969
- * assert.deepStrictEqual(pipe(some(2), exists(isEven)), true)
970
- * assert.deepStrictEqual(pipe(some(1), exists(isEven)), false)
971
- * assert.deepStrictEqual(pipe(none(), exists(isEven)), false)
955
+ * assert.deepStrictEqual(pipe(Option.some(2), Option.exists(isEven)), true)
956
+ * assert.deepStrictEqual(pipe(Option.some(1), Option.exists(isEven)), false)
957
+ * assert.deepStrictEqual(pipe(Option.none(), Option.exists(isEven)), false)
972
958
  *
973
959
  * @since 2.0.0
974
960
  */
@@ -979,6 +965,32 @@ export declare const exists: {
979
965
  <A>(self: Option<A>, predicate: Predicate<A>): boolean;
980
966
  };
981
967
  /**
968
+ * The "do simulation" in 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`.
969
+ *
970
+ * Here's how the do simulation works:
971
+ *
972
+ * 1. Start the do simulation using the `Do` value
973
+ * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Option` values
974
+ * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
975
+ * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
976
+ * 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
977
+ *
978
+ * @see {@link Do}
979
+ * @see {@link bind}
980
+ * @see {@link let_ let}
981
+ *
982
+ * @example
983
+ * import { Option, pipe } from "effect"
984
+ *
985
+ * const result = pipe(
986
+ * Option.Do,
987
+ * Option.bind("x", () => Option.some(2)),
988
+ * Option.bind("y", () => Option.some(3)),
989
+ * Option.let("sum", ({ x, y }) => x + y),
990
+ * Option.filter(({ x, y }) => x * y > 5)
991
+ * )
992
+ * assert.deepStrictEqual(result, Option.some({ x: 2, y: 3, sum: 5 }))
993
+ *
982
994
  * @category do notation
983
995
  * @since 2.0.0
984
996
  */
@@ -1000,11 +1012,63 @@ declare const let_: {
1000
1012
  };
1001
1013
  export {
1002
1014
  /**
1015
+ * The "do simulation" in 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`.
1016
+ *
1017
+ * Here's how the do simulation works:
1018
+ *
1019
+ * 1. Start the do simulation using the `Do` value
1020
+ * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Option` values
1021
+ * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
1022
+ * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
1023
+ * 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
1024
+ *
1025
+ * @see {@link Do}
1026
+ * @see {@link bind}
1027
+ * @see {@link bindTo}
1028
+ *
1029
+ * @example
1030
+ * import { Option, pipe } from "effect"
1031
+ *
1032
+ * const result = pipe(
1033
+ * Option.Do,
1034
+ * Option.bind("x", () => Option.some(2)),
1035
+ * Option.bind("y", () => Option.some(3)),
1036
+ * Option.let("sum", ({ x, y }) => x + y),
1037
+ * Option.filter(({ x, y }) => x * y > 5)
1038
+ * )
1039
+ * assert.deepStrictEqual(result, Option.some({ x: 2, y: 3, sum: 5 }))
1040
+ *
1003
1041
  * @category do notation
1004
1042
  * @since 2.0.0
1005
1043
  */
1006
1044
  let_ as let };
1007
1045
  /**
1046
+ * The "do simulation" in 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`.
1047
+ *
1048
+ * Here's how the do simulation works:
1049
+ *
1050
+ * 1. Start the do simulation using the `Do` value
1051
+ * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Option` values
1052
+ * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
1053
+ * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
1054
+ * 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
1055
+ *
1056
+ * @see {@link Do}
1057
+ * @see {@link bindTo}
1058
+ * @see {@link let_ let}
1059
+ *
1060
+ * @example
1061
+ * import { Option, pipe } from "effect"
1062
+ *
1063
+ * const result = pipe(
1064
+ * Option.Do,
1065
+ * Option.bind("x", () => Option.some(2)),
1066
+ * Option.bind("y", () => Option.some(3)),
1067
+ * Option.let("sum", ({ x, y }) => x + y),
1068
+ * Option.filter(({ x, y }) => x * y > 5)
1069
+ * )
1070
+ * assert.deepStrictEqual(result, Option.some({ x: 2, y: 3, sum: 5 }))
1071
+ *
1008
1072
  * @category do notation
1009
1073
  * @since 2.0.0
1010
1074
  */
@@ -1017,6 +1081,32 @@ export declare const bind: {
1017
1081
  }>;
1018
1082
  };
1019
1083
  /**
1084
+ * The "do simulation" in 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`.
1085
+ *
1086
+ * Here's how the do simulation works:
1087
+ *
1088
+ * 1. Start the do simulation using the `Do` value
1089
+ * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Option` values
1090
+ * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
1091
+ * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
1092
+ * 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
1093
+ *
1094
+ * @see {@link bindTo}
1095
+ * @see {@link bind}
1096
+ * @see {@link let_ let}
1097
+ *
1098
+ * @example
1099
+ * import { Option, pipe } from "effect"
1100
+ *
1101
+ * const result = pipe(
1102
+ * Option.Do,
1103
+ * Option.bind("x", () => Option.some(2)),
1104
+ * Option.bind("y", () => Option.some(3)),
1105
+ * Option.let("sum", ({ x, y }) => x + y),
1106
+ * Option.filter(({ x, y }) => x * y > 5)
1107
+ * )
1108
+ * assert.deepStrictEqual(result, Option.some({ x: 2, y: 3, sum: 5 }))
1109
+ *
1020
1110
  * @category do notation
1021
1111
  * @since 2.0.0
1022
1112
  */