@glutinum/cli 0.14.0 → 0.14.1

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 (144) hide show
  1. package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs +89 -0
  2. package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs.js +105 -0
  3. package/dist/fable_modules/Fable.Promise.3.2.1/Fable.Promise.fableproj +25 -0
  4. package/dist/fable_modules/Fable.Promise.3.2.1/Promise.fs +842 -0
  5. package/dist/fable_modules/Fable.Promise.3.2.1/Promise.fs.js +232 -0
  6. package/dist/fable_modules/Fable.Promise.3.2.1/PromiseImpl.fs +31 -0
  7. package/dist/fable_modules/Fable.Promise.3.2.1/PromiseImpl.fs.js +20 -0
  8. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs +235 -0
  9. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs.js +384 -0
  10. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AssemblyInfo.fs +19 -0
  11. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Async.fs +287 -0
  12. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Async.fs.js +128 -0
  13. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOption.fs +127 -0
  14. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionCE.fs +174 -0
  15. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionCE.fs.js +37 -0
  16. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionOp.fs +24 -0
  17. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResult.fs +483 -0
  18. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultCE.fs +201 -0
  19. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultCE.fs.js +18 -0
  20. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOp.fs +24 -0
  21. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs +87 -0
  22. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs.js +26 -0
  23. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionCE.fs +236 -0
  24. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionCE.fs.js +18 -0
  25. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionOp.fs +24 -0
  26. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidation.fs +185 -0
  27. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationCE.fs +186 -0
  28. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationCE.fs.js +18 -0
  29. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationOp.fs +35 -0
  30. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/FsToolkit.ErrorHandling.fableproj +69 -0
  31. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/List.fs +276 -0
  32. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/List.fs.js +364 -0
  33. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Nullness.fs +81 -0
  34. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Option.fs +462 -0
  35. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs +139 -0
  36. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs.js +48 -0
  37. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionOp.fs +21 -0
  38. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs +88 -0
  39. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs.js +30 -0
  40. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs +200 -0
  41. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs.js +18 -0
  42. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidation.fs +34 -0
  43. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs +244 -0
  44. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs.js +18 -0
  45. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Result.fs +731 -0
  46. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Result.fs.js +45 -0
  47. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultCE.fs +140 -0
  48. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultCE.fs.js +23 -0
  49. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOp.fs +45 -0
  50. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOption.fs +201 -0
  51. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOption.fs.js +65 -0
  52. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionCE.fs +135 -0
  53. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionCE.fs.js +18 -0
  54. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionOp.fs +57 -0
  55. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs +503 -0
  56. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs.js +295 -0
  57. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Validation.fs +167 -0
  58. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationCE.fs +142 -0
  59. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationCE.fs.js +18 -0
  60. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationOp.fs +35 -0
  61. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueOption.fs +148 -0
  62. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOption.fs +102 -0
  63. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOptionCE.fs +587 -0
  64. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOptionOp.fs +10 -0
  65. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +3 -0
  66. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Debug/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
  67. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.fs +3 -0
  68. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
  69. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
  70. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
  71. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +3 -0
  72. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
  73. package/dist/fable_modules/fable-library-js.5.17.2/Array.js +1348 -0
  74. package/dist/fable_modules/fable-library-js.5.17.2/Async.js +163 -0
  75. package/dist/fable_modules/fable-library-js.5.17.2/AsyncBuilder.js +204 -0
  76. package/dist/fable_modules/fable-library-js.5.17.2/BigInt.js +307 -0
  77. package/dist/fable_modules/fable-library-js.5.17.2/BitConverter.js +138 -0
  78. package/dist/fable_modules/fable-library-js.5.17.2/Boolean.js +22 -0
  79. package/dist/fable_modules/fable-library-js.5.17.2/CHANGELOG.md +348 -0
  80. package/dist/fable_modules/fable-library-js.5.17.2/Char.js +202 -0
  81. package/dist/fable_modules/fable-library-js.5.17.2/Choice.js +184 -0
  82. package/dist/fable_modules/fable-library-js.5.17.2/CollectionUtil.js +182 -0
  83. package/dist/fable_modules/fable-library-js.5.17.2/ConditionalWeakTable.js +21 -0
  84. package/dist/fable_modules/fable-library-js.5.17.2/Date.js +834 -0
  85. package/dist/fable_modules/fable-library-js.5.17.2/DateOffset.js +252 -0
  86. package/dist/fable_modules/fable-library-js.5.17.2/DateOnly.js +124 -0
  87. package/dist/fable_modules/fable-library-js.5.17.2/DateOnlyTemporal.js +146 -0
  88. package/dist/fable_modules/fable-library-js.5.17.2/DateTimeFormat.js +523 -0
  89. package/dist/fable_modules/fable-library-js.5.17.2/DateTimeOffsetTemporal.js +283 -0
  90. package/dist/fable_modules/fable-library-js.5.17.2/DateTimeTemporal.js +243 -0
  91. package/dist/fable_modules/fable-library-js.5.17.2/Decimal.js +238 -0
  92. package/dist/fable_modules/fable-library-js.5.17.2/Directory.js +11 -0
  93. package/dist/fable_modules/fable-library-js.5.17.2/Double.js +53 -0
  94. package/dist/fable_modules/fable-library-js.5.17.2/Encoding.js +185 -0
  95. package/dist/fable_modules/fable-library-js.5.17.2/Environment.js +3 -0
  96. package/dist/fable_modules/fable-library-js.5.17.2/Event.js +102 -0
  97. package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Collections.js +45 -0
  98. package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Core.CompilerServices.js +27 -0
  99. package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Core.js +156 -0
  100. package/dist/fable_modules/fable-library-js.5.17.2/File.js +27 -0
  101. package/dist/fable_modules/fable-library-js.5.17.2/Global.js +29 -0
  102. package/dist/fable_modules/fable-library-js.5.17.2/Guid.js +163 -0
  103. package/dist/fable_modules/fable-library-js.5.17.2/Int32.js +135 -0
  104. package/dist/fable_modules/fable-library-js.5.17.2/List.js +1337 -0
  105. package/dist/fable_modules/fable-library-js.5.17.2/Long.js +38 -0
  106. package/dist/fable_modules/fable-library-js.5.17.2/MailboxProcessor.js +100 -0
  107. package/dist/fable_modules/fable-library-js.5.17.2/Map.js +1400 -0
  108. package/dist/fable_modules/fable-library-js.5.17.2/MapUtil.js +130 -0
  109. package/dist/fable_modules/fable-library-js.5.17.2/MutableMap.js +339 -0
  110. package/dist/fable_modules/fable-library-js.5.17.2/MutableSet.js +233 -0
  111. package/dist/fable_modules/fable-library-js.5.17.2/Native.js +14 -0
  112. package/dist/fable_modules/fable-library-js.5.17.2/Numeric.js +112 -0
  113. package/dist/fable_modules/fable-library-js.5.17.2/Observable.js +115 -0
  114. package/dist/fable_modules/fable-library-js.5.17.2/Option.js +87 -0
  115. package/dist/fable_modules/fable-library-js.5.17.2/Path.js +31 -0
  116. package/dist/fable_modules/fable-library-js.5.17.2/README.md +3 -0
  117. package/dist/fable_modules/fable-library-js.5.17.2/Random.js +172 -0
  118. package/dist/fable_modules/fable-library-js.5.17.2/Range.js +45 -0
  119. package/dist/fable_modules/fable-library-js.5.17.2/Reflection.js +489 -0
  120. package/dist/fable_modules/fable-library-js.5.17.2/RegExp.js +170 -0
  121. package/dist/fable_modules/fable-library-js.5.17.2/Result.js +165 -0
  122. package/dist/fable_modules/fable-library-js.5.17.2/Seq.js +1504 -0
  123. package/dist/fable_modules/fable-library-js.5.17.2/Seq2.js +111 -0
  124. package/dist/fable_modules/fable-library-js.5.17.2/Set.js +1829 -0
  125. package/dist/fable_modules/fable-library-js.5.17.2/String.js +731 -0
  126. package/dist/fable_modules/fable-library-js.5.17.2/System.Collections.Generic.js +333 -0
  127. package/dist/fable_modules/fable-library-js.5.17.2/System.Text.js +200 -0
  128. package/dist/fable_modules/fable-library-js.5.17.2/System.js +289 -0
  129. package/dist/fable_modules/fable-library-js.5.17.2/Task.js +27 -0
  130. package/dist/fable_modules/fable-library-js.5.17.2/TaskBuilder.js +72 -0
  131. package/dist/fable_modules/fable-library-js.5.17.2/TimeOnly.js +122 -0
  132. package/dist/fable_modules/fable-library-js.5.17.2/TimeOnlyTemporal.js +142 -0
  133. package/dist/fable_modules/fable-library-js.5.17.2/TimeSpan.js +180 -0
  134. package/dist/fable_modules/fable-library-js.5.17.2/TimeSpanTemporal.js +259 -0
  135. package/dist/fable_modules/fable-library-js.5.17.2/Timer.js +67 -0
  136. package/dist/fable_modules/fable-library-js.5.17.2/Types.js +198 -0
  137. package/dist/fable_modules/fable-library-js.5.17.2/Unicode.13.0.0.js +4 -0
  138. package/dist/fable_modules/fable-library-js.5.17.2/Uri.js +165 -0
  139. package/dist/fable_modules/fable-library-js.5.17.2/Util.js +807 -0
  140. package/dist/fable_modules/fable-library-js.5.17.2/big.d.ts +338 -0
  141. package/dist/fable_modules/fable-library-js.5.17.2/lib/big.js +829 -0
  142. package/dist/fable_modules/fable-library-js.5.17.2/package.json +24 -0
  143. package/dist/fable_modules/fable-library-js.5.17.2/quotation.js +682 -0
  144. package/package.json +1 -1
@@ -0,0 +1,148 @@
1
+ namespace FsToolkit.ErrorHandling
2
+
3
+ [<RequireQualifiedAccess>]
4
+ module ValueOption =
5
+
6
+
7
+ let inline bind ([<InlineIfLambdaAttribute>] f) x =
8
+ match x with
9
+ | ValueSome v -> f v
10
+ | ValueNone -> ValueNone
11
+
12
+ let inline map ([<InlineIfLambdaAttribute>] f) x =
13
+ match x with
14
+ | ValueSome v -> ValueSome(f v)
15
+ | ValueNone -> ValueNone
16
+
17
+ let inline ofOption (opt: 'value option) : 'value voption =
18
+ match opt with
19
+ | Some v -> ValueSome v
20
+ | None -> ValueNone
21
+
22
+ let inline toOption (vopt: 'value voption) : 'value option =
23
+ match vopt with
24
+ | ValueSome v -> Some v
25
+ | ValueNone -> None
26
+
27
+ let inline traverseResult
28
+ ([<InlineIfLambda>] binder: 'okInput -> Result<'okOutput, 'error>)
29
+ (input: 'okInput voption)
30
+ : Result<'okOutput voption, 'error> =
31
+ match input with
32
+ | ValueNone -> Ok ValueNone
33
+ | ValueSome v ->
34
+ binder v
35
+ |> Result.map ValueSome
36
+
37
+ let inline sequenceResult
38
+ (opt: Result<'okOutput, 'error> voption)
39
+ : Result<'okOutput voption, 'error> =
40
+ traverseResult id opt
41
+
42
+ let inline tryParse< ^value
43
+ when ^value: (static member TryParse: string * byref< ^value > -> bool)>
44
+ (valueToParse: string)
45
+ : ^value voption =
46
+ let mutable output = Unchecked.defaultof< ^value>
47
+
48
+ let parsed =
49
+ (^value: (static member TryParse: string * byref< ^value > -> bool) (valueToParse,
50
+ &output))
51
+
52
+ match parsed with
53
+ | true -> ValueSome output
54
+ | _ -> ValueNone
55
+
56
+ let inline tryGetValue (key: 'key) (dictionary: ^Dictionary) : ^value voption =
57
+ let mutable output = Unchecked.defaultof< ^value>
58
+
59
+ let parsed =
60
+ (^Dictionary: (member TryGetValue: 'key * byref< ^value > -> bool) (dictionary,
61
+ key,
62
+ &output))
63
+
64
+ match parsed with
65
+ | true -> ValueSome output
66
+ | false -> ValueNone
67
+
68
+ /// <summary>
69
+ /// Takes two voptions and returns a tuple of the pair or none if either are none
70
+ /// </summary>
71
+ /// <param name="voption1">The input option</param>
72
+ /// <param name="voption2">The input option</param>
73
+ /// <returns></returns>
74
+ let inline zip (left: 'left voption) (right: 'right voption) : ('left * 'right) voption =
75
+ match left, right with
76
+ | ValueSome v1, ValueSome v2 -> ValueSome(v1, v2)
77
+ | _ -> ValueNone
78
+
79
+
80
+ let inline ofResult (result: Result<'ok, 'error>) : 'ok voption =
81
+ match result with
82
+ | Ok v -> ValueSome v
83
+ | Error _ -> ValueNone
84
+
85
+
86
+ /// <summary>
87
+ /// Convert a potentially null value to an ValueOption.
88
+ ///
89
+ /// This is different from <see cref="FSharp.Core.ValueOption.ofObj">ValueOption.ofObj</see> where it doesn't require the value to be constrained to null.
90
+ /// This is beneficial where third party APIs may generate a record type using reflection and it can be null.
91
+ /// See <a href="https://latkin.org/blog/2015/05/18/null-checking-considerations-in-f-its-harder-than-you-think/">Null-checking considerations in F#</a> for more details.
92
+ /// </summary>
93
+ /// <param name="value">The potentially null value</param>
94
+ /// <returns>An ValueOption</returns>
95
+ /// <seealso cref="FSharp.Core.ValueOption.ofObj"/>
96
+ let inline ofNull (value: 'nullableValue) =
97
+ if System.Object.ReferenceEquals(value, null) then
98
+ ValueNone
99
+ else
100
+ ValueSome value
101
+
102
+
103
+ /// <summary>
104
+ ///
105
+ /// <c>bindNull binder voption</c> evaluates to <c>match voption with ValueNone -> ValueNone | ValueSome x -> binder x |> ValueOption.ofNull</c>
106
+ ///
107
+ /// Automatically onverts the result of binder that is pontentially null into an Valueoption.
108
+ /// </summary>
109
+ /// <param name="binder">A function that takes the value of type 'value from an voption and transforms it into
110
+ /// a value of type 'nullableValue.</param>
111
+ /// <param name="voption">The input voption</param>
112
+ /// <typeparam name="'value"></typeparam>
113
+ /// <typeparam name="'nullableValue"></typeparam>
114
+ /// <returns>A voption of the output type of the binder.</returns>
115
+ /// <seealso cref="ofNull"/>
116
+ let inline bindNull
117
+ ([<InlineIfLambda>] binder: 'value -> 'nullableValue)
118
+ (voption: 'value voption)
119
+ : 'nullableValue voption =
120
+ match voption with
121
+ | ValueSome x ->
122
+ binder x
123
+ |> ofNull
124
+ | ValueNone -> ValueNone
125
+
126
+
127
+ /// <summary>
128
+ /// Returns result of running <paramref name="onSome"/> if it is <c>ValueSome</c>, otherwise returns result of running <paramref name="onNone"/>
129
+ /// </summary>
130
+ /// <param name="onSome">The function to run if <paramref name="input"/> is <c>ValueSome</c></param>
131
+ /// <param name="onNone">The function to run if <paramref name="input"/> is <c>ValueNone</c></param>
132
+ /// <param name="input">The input option.</param>
133
+ /// <returns>
134
+ /// The result of running <paramref name="onSome"/> if the input is <c>ValueSome</c>, else returns result of running <paramref name="onNone"/>.
135
+ /// </returns>
136
+ let inline either
137
+ ([<InlineIfLambda>] onSome: 'a -> 'output)
138
+ ([<InlineIfLambda>] onNone: unit -> 'output)
139
+ (input: 'a voption)
140
+ : 'output =
141
+ match input with
142
+ | ValueSome x -> onSome x
143
+ | ValueNone -> onNone ()
144
+
145
+ let inline ofPair (input: bool * 'a) =
146
+ match input with
147
+ | true, x -> ValueSome x
148
+ | false, _ -> ValueNone
@@ -0,0 +1,102 @@
1
+ namespace FsToolkit.ErrorHandling
2
+
3
+ open System.Threading.Tasks
4
+
5
+
6
+ [<RequireQualifiedAccess>]
7
+ module ValueTaskValueOption =
8
+
9
+ let inline map ([<InlineIfLambda>] f) (ar: ValueTask<_ voption>) =
10
+ ValueTask<_ voption>(
11
+ task {
12
+ let! opt = ar
13
+ return ValueOption.map f opt
14
+ }
15
+ )
16
+
17
+ let inline bind ([<InlineIfLambda>] f) (ar: ValueTask<_ voption>) =
18
+ ValueTask<_ voption>(
19
+ task {
20
+ let! opt = ar
21
+
22
+ let t =
23
+ match opt with
24
+ | ValueSome x -> f x
25
+ | ValueNone -> ValueTask<_ voption>(ValueNone)
26
+
27
+ return! t
28
+ }
29
+ )
30
+
31
+ let inline valueSome x = ValueTask<_ voption>(ValueSome x)
32
+
33
+ let inline apply f x =
34
+ bind (fun f' -> bind (fun x' -> valueSome (f' x')) x) f
35
+
36
+ let inline zip (x1: ValueTask<'a voption>) (x2: ValueTask<'b voption>) =
37
+ ValueTask<('a * 'b) voption>(
38
+ task {
39
+ let! r1 = x1
40
+ let! r2 = x2
41
+ return ValueOption.zip r1 r2
42
+ }
43
+ )
44
+
45
+ /// <summary>
46
+ /// Returns result of running <paramref name="onValueSome"/> if it is <c>ValueSome</c>, otherwise returns result of running <paramref name="onValueNone"/>
47
+ /// </summary>
48
+ /// <param name="onValueSome">The function to run if <paramref name="input"/> is <c>ValueSome</c></param>
49
+ /// <param name="onValueNone">The function to run if <paramref name="input"/> is <c>ValueNone</c></param>
50
+ /// <param name="input">The input voption.</param>
51
+ /// <returns>
52
+ /// The result of running <paramref name="onValueSome"/> if the input is <c>ValueSome</c>, else returns result of running <paramref name="onValueNone"/>.
53
+ /// </returns>
54
+ let inline either
55
+ ([<InlineIfLambda>] onValueSome: 'input -> ValueTask<'output>)
56
+ ([<InlineIfLambda>] onValueNone: unit -> ValueTask<'output>)
57
+ (input: ValueTask<'input voption>)
58
+ : ValueTask<'output> =
59
+ ValueTask<'output>(
60
+ task {
61
+ let! opt = input
62
+
63
+ match opt with
64
+ | ValueSome v -> return! onValueSome v
65
+ | ValueNone -> return! onValueNone ()
66
+ }
67
+ )
68
+
69
+ /// <summary>
70
+ /// Gets the value of the voption if the voption is <c>ValueSome</c>, otherwise returns the specified default value.
71
+ /// </summary>
72
+ /// <param name="value">The specified default value.</param>
73
+ /// <param name="valueTaskValueOption">The input voption.</param>
74
+ /// <returns>
75
+ /// The voption if the voption is <c>ValueSome</c>, else the default value.
76
+ /// </returns>
77
+ let inline defaultValue (value: 'value) (valueTaskValueOption: ValueTask<'value voption>) =
78
+ ValueTask<'value>(
79
+ task {
80
+ let! opt = valueTaskValueOption
81
+ return ValueOption.defaultValue value opt
82
+ }
83
+ )
84
+
85
+ /// <summary>
86
+ /// Gets the value of the voption if the voption is <c>ValueSome</c>, otherwise evaluates <paramref name="defThunk"/> and returns the result.
87
+ /// </summary>
88
+ /// <param name="defThunk">A thunk that provides a default value when evaluated.</param>
89
+ /// <param name="valueTaskValueOption">The input voption.</param>
90
+ /// <returns>
91
+ /// The voption if the voption is <c>ValueSome</c>, else the result of evaluating <paramref name="defThunk"/>.
92
+ /// </returns>
93
+ let inline defaultWith
94
+ ([<InlineIfLambda>] defThunk: unit -> 'value)
95
+ (valueTaskValueOption: ValueTask<'value voption>)
96
+ : ValueTask<'value> =
97
+ ValueTask<'value>(
98
+ task {
99
+ let! opt = valueTaskValueOption
100
+ return ValueOption.defaultWith defThunk opt
101
+ }
102
+ )