@glutinum/cli 0.10.0 → 0.12.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.
- package/README.md +48 -0
- package/dist/Glutinum.Converter/FsharpAST.js +76 -21
- package/dist/Glutinum.Converter/FsharpAST.js.map +1 -1
- package/dist/Glutinum.Converter/Generate.js +5 -7
- package/dist/Glutinum.Converter/Generate.js.map +1 -1
- package/dist/Glutinum.Converter/GlueAST.js +90 -14
- package/dist/Glutinum.Converter/GlueAST.js.map +1 -1
- package/dist/Glutinum.Converter/Log.js +5 -5
- package/dist/Glutinum.Converter/Log.js.map +1 -1
- package/dist/Glutinum.Converter/Merge.js +7 -7
- package/dist/Glutinum.Converter/Merge.js.map +1 -1
- package/dist/Glutinum.Converter/Printer.js +203 -106
- package/dist/Glutinum.Converter/Printer.js.map +1 -1
- package/dist/Glutinum.Converter/Read.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/Declaration.js +20 -19
- package/dist/Glutinum.Converter/Reader/Declaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/Documentation.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/EnumDeclaration.js +4 -3
- package/dist/Glutinum.Converter/Reader/EnumDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +2 -2
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +5 -6
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +42 -0
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js.map +1 -0
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/NamedTupleMember.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/Node.js +8 -5
- package/dist/Glutinum.Converter/Reader/Node.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/Parameters.js +7 -4
- package/dist/Glutinum.Converter/Reader/Parameters.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/Report.js +35 -0
- package/dist/Glutinum.Converter/Reader/Report.js.map +1 -0
- package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +5 -0
- package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/TypeNode.js +250 -69
- package/dist/Glutinum.Converter/Reader/TypeNode.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +31 -26
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/TypeParameters.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +127 -0
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js.map +1 -0
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +7 -2
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +6 -9
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/Utils.js +35 -13
- package/dist/Glutinum.Converter/Reader/Utils.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/VariableStatement.js +2 -2
- package/dist/Glutinum.Converter/Reader/VariableStatement.js.map +1 -1
- package/dist/Glutinum.Converter/Transform.js +614 -211
- package/dist/Glutinum.Converter/Transform.js.map +1 -1
- package/dist/Glutinum.Converter/TypeScript.Extensions.js +745 -0
- package/dist/Glutinum.Converter/TypeScript.Extensions.js.map +1 -0
- package/dist/Glutinum.Converter/Utils/Naming.js +6 -2
- package/dist/Glutinum.Converter/Utils/Naming.js.map +1 -1
- package/dist/Program.js +2 -2
- package/dist/Program.js.map +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AssemblyInfo.fs +19 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Async.fs +207 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Async.fs.js +127 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Async.fs.js.map +1 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOption.fs +81 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOptionCE.fs +183 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOptionCE.fs.js +37 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOptionCE.fs.js.map +1 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOptionOp.fs +24 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResult.fs +439 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultCE.fs +217 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultCE.fs.js.map +1 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOp.fs +24 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOption.fs +75 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOption.fs.js +26 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOption.fs.js.map +1 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOptionCE.fs +238 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOptionCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOptionCE.fs.js.map +1 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOptionOp.fs +24 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidation.fs +190 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidationCE.fs +194 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidationCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidationCE.fs.js.map +1 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidationOp.fs +35 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/FsToolkit.ErrorHandling.fableproj +51 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/List.fs +218 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/List.fs.js +358 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/List.fs.js.map +1 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Option.fs +331 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs +186 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs.js.map +1 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionOp.fs +21 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Result.fs +644 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Result.fs.js +45 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Result.fs.js.map +1 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultCE.fs +155 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultCE.fs.js +23 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultCE.fs.js.map +1 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOp.fs +45 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOption.fs +201 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOption.fs.js +65 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOption.fs.js.map +1 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOptionCE.fs +146 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOptionCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOptionCE.fs.js.map +1 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOptionOp.fs +57 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs +19 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs.js +31 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs.js.map +1 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs +22 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs.js.map +1 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Validation.fs +172 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValidationCE.fs +148 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValidationCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValidationCE.fs.js.map +1 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValidationOp.fs +35 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValueOption.fs +151 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValueOptionCE.fs +165 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Debug/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Release/netstandard2.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Release/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Release/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/project_cracked.json +1 -1
- package/package.json +3 -2
- package/src/Glutinum.Converter/js/bootstrap.js +16 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
namespace FsToolkit.ErrorHandling
|
|
2
|
+
|
|
3
|
+
open System.Threading.Tasks
|
|
4
|
+
open System
|
|
5
|
+
|
|
6
|
+
[<AutoOpen>]
|
|
7
|
+
module AsyncResultCE =
|
|
8
|
+
|
|
9
|
+
type AsyncResultBuilder() =
|
|
10
|
+
|
|
11
|
+
member inline _.Return(value: 'ok) : Async<Result<'ok, 'error>> =
|
|
12
|
+
result.Return value
|
|
13
|
+
|> async.Return
|
|
14
|
+
|
|
15
|
+
member inline _.ReturnFrom
|
|
16
|
+
(asyncResult: Async<Result<'ok, 'error>>)
|
|
17
|
+
: Async<Result<'ok, 'error>> =
|
|
18
|
+
asyncResult
|
|
19
|
+
|
|
20
|
+
member inline _.Zero() : Async<Result<unit, 'error>> =
|
|
21
|
+
result.Zero()
|
|
22
|
+
|> async.Return
|
|
23
|
+
|
|
24
|
+
member inline _.Bind
|
|
25
|
+
(
|
|
26
|
+
asyncResult: Async<Result<'okInput, 'error>>,
|
|
27
|
+
[<InlineIfLambda>] binder: 'okInput -> Async<Result<'okOutput, 'error>>
|
|
28
|
+
) : Async<Result<'okOutput, 'error>> =
|
|
29
|
+
AsyncResult.bind binder asyncResult
|
|
30
|
+
|
|
31
|
+
member inline _.Delay
|
|
32
|
+
([<InlineIfLambda>] generator: unit -> Async<Result<'ok, 'error>>)
|
|
33
|
+
: Async<Result<'ok, 'error>> =
|
|
34
|
+
async.Delay generator
|
|
35
|
+
|
|
36
|
+
member inline this.Combine
|
|
37
|
+
(
|
|
38
|
+
computation1: Async<Result<unit, 'error>>,
|
|
39
|
+
computation2: Async<Result<'ok, 'error>>
|
|
40
|
+
) : Async<Result<'ok, 'error>> =
|
|
41
|
+
this.Bind(computation1, (fun () -> computation2))
|
|
42
|
+
|
|
43
|
+
member inline _.TryWith
|
|
44
|
+
(
|
|
45
|
+
computation: Async<Result<'ok, 'error>>,
|
|
46
|
+
[<InlineIfLambda>] handler: System.Exception -> Async<Result<'ok, 'error>>
|
|
47
|
+
) : Async<Result<'ok, 'error>> =
|
|
48
|
+
async.TryWith(computation, handler)
|
|
49
|
+
|
|
50
|
+
member inline _.TryFinally
|
|
51
|
+
(
|
|
52
|
+
computation: Async<Result<'ok, 'error>>,
|
|
53
|
+
[<InlineIfLambda>] compensation: unit -> unit
|
|
54
|
+
) : Async<Result<'ok, 'error>> =
|
|
55
|
+
async.TryFinally(computation, compensation)
|
|
56
|
+
|
|
57
|
+
#if NETSTANDARD2_1
|
|
58
|
+
|
|
59
|
+
member inline _.TryFinallyAsync
|
|
60
|
+
(
|
|
61
|
+
computation: Async<Result<'ok, 'error>>,
|
|
62
|
+
[<InlineIfLambda>] compensation: unit -> ValueTask
|
|
63
|
+
) : Async<Result<'ok, 'error>> =
|
|
64
|
+
let compensation =
|
|
65
|
+
async {
|
|
66
|
+
let vTask = compensation ()
|
|
67
|
+
|
|
68
|
+
if vTask.IsCompletedSuccessfully then
|
|
69
|
+
return ()
|
|
70
|
+
else
|
|
71
|
+
return!
|
|
72
|
+
vTask.AsTask()
|
|
73
|
+
|> Async.AwaitTask
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
Async.TryFinallyAsync(computation, compensation)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
member inline this.Using
|
|
80
|
+
(
|
|
81
|
+
resource: 'ok :> IAsyncDisposable,
|
|
82
|
+
[<InlineIfLambda>] binder: 'ok -> Async<Result<'U, 'error>>
|
|
83
|
+
) : Async<Result<'U, 'error>> =
|
|
84
|
+
this.TryFinallyAsync(
|
|
85
|
+
binder resource,
|
|
86
|
+
(fun () ->
|
|
87
|
+
if not (isNull (box resource)) then
|
|
88
|
+
resource.DisposeAsync()
|
|
89
|
+
else
|
|
90
|
+
ValueTask()
|
|
91
|
+
)
|
|
92
|
+
)
|
|
93
|
+
#endif
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
member inline this.While
|
|
97
|
+
(
|
|
98
|
+
[<InlineIfLambda>] guard: unit -> bool,
|
|
99
|
+
computation: Async<Result<unit, 'error>>
|
|
100
|
+
) : Async<Result<unit, 'error>> =
|
|
101
|
+
if guard () then
|
|
102
|
+
let mutable whileAsync = Unchecked.defaultof<_>
|
|
103
|
+
|
|
104
|
+
whileAsync <-
|
|
105
|
+
this.Bind(computation, (fun () -> if guard () then whileAsync else this.Zero()))
|
|
106
|
+
|
|
107
|
+
whileAsync
|
|
108
|
+
else
|
|
109
|
+
this.Zero()
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
member inline _.BindReturn
|
|
113
|
+
(
|
|
114
|
+
x: Async<Result<'okInput, 'error>>,
|
|
115
|
+
[<InlineIfLambda>] f: 'okInput -> 'okOutput
|
|
116
|
+
) : Async<Result<'okOutput, 'error>> =
|
|
117
|
+
AsyncResult.map f x
|
|
118
|
+
|
|
119
|
+
member inline _.MergeSources
|
|
120
|
+
(
|
|
121
|
+
t1: Async<Result<'leftOk, 'error>>,
|
|
122
|
+
t2: Async<Result<'rightOk, 'error>>
|
|
123
|
+
) : Async<Result<'leftOk * 'rightOk, 'error>> =
|
|
124
|
+
AsyncResult.zip t1 t2
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
/// <summary>
|
|
128
|
+
/// Method lets us transform data types into our internal representation. This is the identity method to recognize the self type.
|
|
129
|
+
///
|
|
130
|
+
/// See https://stackoverflow.com/questions/35286541/why-would-you-use-builder-source-in-a-custom-computation-expression-builder
|
|
131
|
+
/// </summary>
|
|
132
|
+
member inline _.Source(result: Async<Result<'ok, 'error>>) : Async<Result<'ok, 'error>> =
|
|
133
|
+
result
|
|
134
|
+
|
|
135
|
+
#if !FABLE_COMPILER
|
|
136
|
+
/// <summary>
|
|
137
|
+
/// Method lets us transform data types into our internal representation.
|
|
138
|
+
/// </summary>
|
|
139
|
+
member inline _.Source(task: Task<Result<'ok, 'error>>) : Async<Result<'ok, 'error>> =
|
|
140
|
+
task
|
|
141
|
+
|> Async.AwaitTask
|
|
142
|
+
#endif
|
|
143
|
+
|
|
144
|
+
let asyncResult = AsyncResultBuilder()
|
|
145
|
+
|
|
146
|
+
[<AutoOpen>]
|
|
147
|
+
module AsyncResultCEExtensions =
|
|
148
|
+
|
|
149
|
+
type AsyncResultBuilder with
|
|
150
|
+
|
|
151
|
+
/// <summary>
|
|
152
|
+
/// Needed to allow `for..in` and `for..do` functionality
|
|
153
|
+
/// </summary>
|
|
154
|
+
member inline _.Source(s: #seq<'value>) : #seq<'value> = s
|
|
155
|
+
|
|
156
|
+
/// <summary>
|
|
157
|
+
/// Method lets us transform data types into our internal representation.
|
|
158
|
+
/// </summary>
|
|
159
|
+
member inline _.Source(result: Result<'ok, 'error>) : Async<Result<'ok, 'error>> =
|
|
160
|
+
Async.singleton result
|
|
161
|
+
|
|
162
|
+
/// <summary>
|
|
163
|
+
/// Method lets us transform data types into our internal representation.
|
|
164
|
+
/// </summary>
|
|
165
|
+
member inline _.Source(choice: Choice<'ok, 'error>) : Async<Result<'ok, 'error>> =
|
|
166
|
+
choice
|
|
167
|
+
|> Result.ofChoice
|
|
168
|
+
|> Async.singleton
|
|
169
|
+
|
|
170
|
+
/// <summary>
|
|
171
|
+
/// Method lets us transform data types into our internal representation.
|
|
172
|
+
/// </summary>
|
|
173
|
+
member inline _.Source(asyncComputation: Async<'ok>) : Async<Result<'ok, 'error>> =
|
|
174
|
+
asyncComputation
|
|
175
|
+
|> Async.map Ok
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
member inline _.Using
|
|
179
|
+
(
|
|
180
|
+
resource: 'ok :> IDisposable,
|
|
181
|
+
[<InlineIfLambda>] binder: 'ok -> Async<Result<'U, 'error>>
|
|
182
|
+
) : Async<Result<'U, 'error>> =
|
|
183
|
+
async.Using(resource, binder)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
member inline this.For
|
|
187
|
+
(
|
|
188
|
+
sequence: #seq<'ok>,
|
|
189
|
+
[<InlineIfLambda>] binder: 'ok -> Async<Result<unit, 'error>>
|
|
190
|
+
) : Async<Result<unit, 'error>> =
|
|
191
|
+
this.Using(
|
|
192
|
+
sequence.GetEnumerator(),
|
|
193
|
+
fun enum ->
|
|
194
|
+
this.While(
|
|
195
|
+
(fun () -> enum.MoveNext()),
|
|
196
|
+
this.Delay(fun () -> binder enum.Current)
|
|
197
|
+
)
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
#if !FABLE_COMPILER
|
|
202
|
+
/// <summary>
|
|
203
|
+
/// Method lets us transform data types into our internal representation.
|
|
204
|
+
/// </summary>
|
|
205
|
+
member inline _.Source(task: Task<'ok>) : Async<Result<'ok, 'error>> =
|
|
206
|
+
task
|
|
207
|
+
|> Async.AwaitTask
|
|
208
|
+
|> Async.map Ok
|
|
209
|
+
|
|
210
|
+
/// <summary>
|
|
211
|
+
/// Method lets us transform data types into our internal representation.
|
|
212
|
+
/// </summary>
|
|
213
|
+
member inline _.Source(task: Task) : Async<Result<unit, 'error>> =
|
|
214
|
+
task
|
|
215
|
+
|> Async.AwaitTask
|
|
216
|
+
|> Async.map Ok
|
|
217
|
+
#endif
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { class_type } from "../fable-library-js.4.14.0/Reflection.js";
|
|
2
|
+
|
|
3
|
+
export class AsyncResultCE_AsyncResultBuilder {
|
|
4
|
+
constructor() {
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function AsyncResultCE_AsyncResultBuilder_$reflection() {
|
|
9
|
+
return class_type("FsToolkit.ErrorHandling.AsyncResultCE.AsyncResultBuilder", void 0, AsyncResultCE_AsyncResultBuilder);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function AsyncResultCE_AsyncResultBuilder_$ctor() {
|
|
13
|
+
return new AsyncResultCE_AsyncResultBuilder();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const AsyncResultCE_asyncResult = AsyncResultCE_AsyncResultBuilder_$ctor();
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=AsyncResultCE.fs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["./AsyncResultCE.fs"],"names":["\u0060\u0060.ctor\u0060\u0060"],"mappings":";;;;;;;;;;;;;;;yCA\u002BIsB,AAAAA","file":null,"sourcesContent":null,"sourceRoot":null}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
namespace FsToolkit.ErrorHandling.Operator.AsyncResult
|
|
2
|
+
|
|
3
|
+
open FsToolkit.ErrorHandling
|
|
4
|
+
|
|
5
|
+
[<AutoOpen>]
|
|
6
|
+
module AsyncResult =
|
|
7
|
+
|
|
8
|
+
let inline (<!>)
|
|
9
|
+
(([<InlineIfLambda>] mapper: 'okInput -> 'okOutput))
|
|
10
|
+
(input: Async<Result<'okInput, 'error>>)
|
|
11
|
+
: Async<Result<'okOutput, 'error>> =
|
|
12
|
+
AsyncResult.map mapper input
|
|
13
|
+
|
|
14
|
+
let inline (<*>)
|
|
15
|
+
(applier: Async<Result<'okInput -> 'okOutput, 'error>>)
|
|
16
|
+
(input: Async<Result<'okInput, 'error>>)
|
|
17
|
+
: Async<Result<'okOutput, 'error>> =
|
|
18
|
+
AsyncResult.apply applier input
|
|
19
|
+
|
|
20
|
+
let inline (>>=)
|
|
21
|
+
(input: Async<Result<'input, 'error>>)
|
|
22
|
+
([<InlineIfLambda>] binder: 'input -> Async<Result<'okOutput, 'error>>)
|
|
23
|
+
: Async<Result<'okOutput, 'error>> =
|
|
24
|
+
AsyncResult.bind binder input
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
namespace FsToolkit.ErrorHandling
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
type AsyncResultOption<'ok, 'error> = Async<Result<Option<'ok>, 'error>>
|
|
5
|
+
|
|
6
|
+
[<RequireQualifiedAccess>]
|
|
7
|
+
module AsyncResultOption =
|
|
8
|
+
|
|
9
|
+
let inline map
|
|
10
|
+
([<InlineIfLambda>] mapper: 'okInput -> 'okOutput)
|
|
11
|
+
(input: Async<Result<'okInput option, 'error>>)
|
|
12
|
+
: Async<Result<'okOutput option, 'error>> =
|
|
13
|
+
AsyncResult.map (Option.map mapper) input
|
|
14
|
+
|
|
15
|
+
let inline bind
|
|
16
|
+
([<InlineIfLambda>] binder: 'okInput -> Async<Result<'okOutput option, 'error>>)
|
|
17
|
+
(input: Async<Result<'okInput option, 'error>>)
|
|
18
|
+
: Async<Result<'okOutput option, 'error>> =
|
|
19
|
+
AsyncResult.bind
|
|
20
|
+
(fun opt ->
|
|
21
|
+
match opt with
|
|
22
|
+
| Some x -> binder x
|
|
23
|
+
| None -> AsyncResult.retn None
|
|
24
|
+
)
|
|
25
|
+
input
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
let inline map2
|
|
29
|
+
([<InlineIfLambda>] mapper: 'okInput1 -> 'okInput2 -> 'okOutput)
|
|
30
|
+
(input1: Async<Result<'okInput1 option, 'error>>)
|
|
31
|
+
(input2: Async<Result<'okInput2 option, 'error>>)
|
|
32
|
+
: Async<Result<'okOutput option, 'error>> =
|
|
33
|
+
AsyncResult.map2 (Option.map2 mapper) input1 input2
|
|
34
|
+
|
|
35
|
+
let inline map3
|
|
36
|
+
([<InlineIfLambda>] mapper: 'okInput1 -> 'okInput2 -> 'okInput3 -> 'okOutput)
|
|
37
|
+
(input1: Async<Result<'okInput1 option, 'error>>)
|
|
38
|
+
(input2: Async<Result<'okInput2 option, 'error>>)
|
|
39
|
+
(input3: Async<Result<'okInput3 option, 'error>>)
|
|
40
|
+
: Async<Result<'okOutput option, 'error>> =
|
|
41
|
+
AsyncResult.map3 (Option.map3 mapper) input1 input2 input3
|
|
42
|
+
|
|
43
|
+
let inline retn (value: 'ok) : Async<Result<'ok option, 'error>> = AsyncResult.retn (Some value)
|
|
44
|
+
|
|
45
|
+
let apply
|
|
46
|
+
(applier: Async<Result<('okInput -> 'okOutput) option, 'error>>)
|
|
47
|
+
(input: Async<Result<'okInput option, 'error>>)
|
|
48
|
+
: Async<Result<'okOutput option, 'error>> =
|
|
49
|
+
map2 (fun f x -> f x) applier input
|
|
50
|
+
|
|
51
|
+
/// Replaces the wrapped value with unit
|
|
52
|
+
let ignore<'ok, 'error>
|
|
53
|
+
(value: Async<Result<'ok option, 'error>>)
|
|
54
|
+
: Async<Result<unit option, 'error>> =
|
|
55
|
+
value
|
|
56
|
+
|> map ignore<'ok>
|
|
57
|
+
|
|
58
|
+
let inline ofResult (r: Result<'ok, 'error>) =
|
|
59
|
+
r
|
|
60
|
+
|> Result.map Some
|
|
61
|
+
|> Async.singleton
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
let inline ofAsyncResult (r: Async<Result<'ok, 'error>>) =
|
|
65
|
+
r
|
|
66
|
+
|> AsyncResult.map Some
|
|
67
|
+
|
|
68
|
+
let inline ofOption (r: Option<'ok>) =
|
|
69
|
+
r
|
|
70
|
+
|> Ok
|
|
71
|
+
|> Async.singleton
|
|
72
|
+
|
|
73
|
+
let inline ofAsyncOption (r: Async<Option<'ok>>) =
|
|
74
|
+
r
|
|
75
|
+
|> Async.map Ok
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { singleton } from "../fable-library-js.4.14.0/AsyncBuilder.js";
|
|
2
|
+
import { FSharpResult$2 } from "../fable-library-js.4.14.0/Result.js";
|
|
3
|
+
import { some, value as value_4 } from "../fable-library-js.4.14.0/Option.js";
|
|
4
|
+
|
|
5
|
+
export function AsyncResultOption_apply(applier, input) {
|
|
6
|
+
return singleton.Bind(applier, (x_3) => singleton.Bind(input, (y_2) => {
|
|
7
|
+
let copyOfStruct, copyOfStruct_1, input1_1, input2_1, x_1, y;
|
|
8
|
+
const value = (copyOfStruct = x_3, (copyOfStruct.tag === 1) ? (new FSharpResult$2(1, [copyOfStruct.fields[0]])) : ((copyOfStruct_1 = y_2, (copyOfStruct_1.tag === 1) ? (new FSharpResult$2(1, [copyOfStruct_1.fields[0]])) : (new FSharpResult$2(0, [(input1_1 = copyOfStruct.fields[0], (input2_1 = copyOfStruct_1.fields[0], (input1_1 != null) ? ((input2_1 != null) ? ((x_1 = input1_1, (y = value_4(input2_1), some(x_1(y))))) : void 0) : void 0))])))));
|
|
9
|
+
return singleton.Return(value);
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Replaces the wrapped value with unit
|
|
15
|
+
*/
|
|
16
|
+
export function AsyncResultOption_ignore(value) {
|
|
17
|
+
return singleton.Bind(value, (x$0027) => {
|
|
18
|
+
let input_2;
|
|
19
|
+
let value_2;
|
|
20
|
+
const input_4 = x$0027;
|
|
21
|
+
value_2 = ((input_4.tag === 1) ? (new FSharpResult$2(1, [input_4.fields[0]])) : (new FSharpResult$2(0, [(input_2 = input_4.fields[0], (input_2 == null) ? void 0 : some(void value_4(input_2)))])));
|
|
22
|
+
return singleton.Return(value_2);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=AsyncResultOption.fs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["./Async.fs","./AsyncResultOption.fs","./Result.fs","./Option.fs"],"names":["applier","input","copyOfStruct","input1","input2","x","y","value","x\u0027"],"mappings":";;;;;WAoCQ,eCYsBA,kBDZtB,eCY8BC;YCsGxBC,cAAAA,gBCjGLC,UACAC,UAGMC,KAAQC;AHwBIC,uBEqEbL,eFtEiBG,KEsEjB,CAAA,AAAAH,2BAGU,uBAHV,AAAAA,8BAAAA,iBFtEmBI,KEsEnB,CAAA,AAAAJ,6BAGU,uBAHV,AAAAA,\u002BBACU,wBClGfC,WDiGK,AAAAD,yBChGLE,WDgGK,AAAAF,0BC9FA,CAAA,AAACC,qBAAD,CAAA,AAASC,sBACRC,MADAF,WACQG,YADAF,WACK,KFTH,AESeC,IAAEC,SAC3B,UAAA;AH3CJ,eAAA,iBAkEgBC;;;;;;;;WA7CnB,eCkBAA;YElBCN;AHwBUM;AE1CVN,wBFyCcO;AEvCT,AFwCKD,mBExCL,CAAA,AAAAN,sBAEO,uBAAA,AAAAA,wBADH,wBCeTA,UDfS,AAAAA,mBCiBJ,CAAA,AAAAA,mBAEI,SADE,KAAA,aAAAA;AHxBT,eAAA,iBA6CQM","file":null,"sourcesContent":null,"sourceRoot":null}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
namespace FsToolkit.ErrorHandling
|
|
2
|
+
|
|
3
|
+
open System
|
|
4
|
+
open System.Threading.Tasks
|
|
5
|
+
|
|
6
|
+
[<AutoOpen>]
|
|
7
|
+
module AsyncResultOptionCE =
|
|
8
|
+
|
|
9
|
+
type AsyncResultOptionBuilder() =
|
|
10
|
+
member inline _.Return(value: 'ok) : AsyncResultOption<'ok, 'error> =
|
|
11
|
+
AsyncResultOption.retn value
|
|
12
|
+
|
|
13
|
+
member inline _.ReturnFrom
|
|
14
|
+
(value: Async<Result<'ok option, 'error>>)
|
|
15
|
+
: Async<Result<'ok option, 'error>> =
|
|
16
|
+
value
|
|
17
|
+
|
|
18
|
+
member inline _.Bind
|
|
19
|
+
(
|
|
20
|
+
input: AsyncResultOption<'okInput, 'error>,
|
|
21
|
+
[<InlineIfLambda>] binder: 'okInput -> AsyncResultOption<'okOutput, 'error>
|
|
22
|
+
) : AsyncResultOption<'okOutput, 'error> =
|
|
23
|
+
AsyncResultOption.bind binder input
|
|
24
|
+
|
|
25
|
+
member inline _.Combine(aro1, aro2) =
|
|
26
|
+
aro1
|
|
27
|
+
|> AsyncResultOption.bind (fun _ -> aro2)
|
|
28
|
+
|
|
29
|
+
member inline _.Delay([<InlineIfLambda>] f: unit -> Async<'a>) : Async<'a> = async.Delay f
|
|
30
|
+
|
|
31
|
+
member inline _.Zero() = Async.singleton (Ok(option.Zero()))
|
|
32
|
+
|
|
33
|
+
member inline _.TryWith
|
|
34
|
+
(
|
|
35
|
+
computation: AsyncResultOption<'ok, 'error>,
|
|
36
|
+
[<InlineIfLambda>] handler: Exception -> AsyncResultOption<'ok, 'error>
|
|
37
|
+
) : AsyncResultOption<'ok, 'error> =
|
|
38
|
+
async.TryWith(computation, handler)
|
|
39
|
+
|
|
40
|
+
member inline _.TryFinally
|
|
41
|
+
(
|
|
42
|
+
computation: AsyncResultOption<'ok, 'error>,
|
|
43
|
+
[<InlineIfLambda>] compensation: unit -> unit
|
|
44
|
+
) : AsyncResultOption<'ok, 'error> =
|
|
45
|
+
async.TryFinally(computation, compensation)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
#if NETSTANDARD2_1
|
|
49
|
+
|
|
50
|
+
member inline _.TryFinallyAsync
|
|
51
|
+
(
|
|
52
|
+
computation: AsyncResultOption<'ok, 'error>,
|
|
53
|
+
[<InlineIfLambda>] compensation: unit -> ValueTask
|
|
54
|
+
) : AsyncResultOption<'ok, 'error> =
|
|
55
|
+
let compensation =
|
|
56
|
+
async {
|
|
57
|
+
let vTask = compensation ()
|
|
58
|
+
|
|
59
|
+
if vTask.IsCompletedSuccessfully then
|
|
60
|
+
return ()
|
|
61
|
+
else
|
|
62
|
+
return!
|
|
63
|
+
vTask.AsTask()
|
|
64
|
+
|> Async.AwaitTask
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
Async.TryFinallyAsync(computation, compensation)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
member inline this.Using
|
|
71
|
+
(
|
|
72
|
+
resource: 'ok :> IAsyncDisposable,
|
|
73
|
+
[<InlineIfLambda>] binder: 'ok -> AsyncResultOption<'okOut, 'error>
|
|
74
|
+
) : AsyncResultOption<'okOut, 'error> =
|
|
75
|
+
this.TryFinallyAsync(
|
|
76
|
+
binder resource,
|
|
77
|
+
(fun () ->
|
|
78
|
+
if not (isNull (box resource)) then
|
|
79
|
+
resource.DisposeAsync()
|
|
80
|
+
else
|
|
81
|
+
ValueTask()
|
|
82
|
+
)
|
|
83
|
+
)
|
|
84
|
+
#endif
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
member inline this.While
|
|
88
|
+
(
|
|
89
|
+
[<InlineIfLambda>] guard: unit -> bool,
|
|
90
|
+
computation: AsyncResultOption<unit, 'error>
|
|
91
|
+
) : AsyncResultOption<unit, 'error> =
|
|
92
|
+
if guard () then
|
|
93
|
+
let mutable whileAsync = Unchecked.defaultof<_>
|
|
94
|
+
|
|
95
|
+
whileAsync <-
|
|
96
|
+
this.Bind(computation, (fun () -> if guard () then whileAsync else this.Zero()))
|
|
97
|
+
|
|
98
|
+
whileAsync
|
|
99
|
+
else
|
|
100
|
+
this.Zero()
|
|
101
|
+
|
|
102
|
+
/// <summary>
|
|
103
|
+
/// Method lets us transform data types into our internal representation. This is the identity method to recognize the self type.
|
|
104
|
+
///
|
|
105
|
+
/// See https://stackoverflow.com/questions/35286541/why-would-you-use-builder-source-in-a-custom-computation-expression-builder
|
|
106
|
+
/// </summary>
|
|
107
|
+
member inline _.Source
|
|
108
|
+
(result: AsyncResultOption<'ok, 'error>)
|
|
109
|
+
: AsyncResultOption<'ok, 'error> =
|
|
110
|
+
result
|
|
111
|
+
#if !FABLE_COMPILER
|
|
112
|
+
|
|
113
|
+
/// <summary>
|
|
114
|
+
/// Method lets us transform data types into our internal representation. This is the identity method to recognize the self type.
|
|
115
|
+
///
|
|
116
|
+
/// See https://stackoverflow.com/questions/35286541/why-would-you-use-builder-source-in-a-custom-computation-expression-builder
|
|
117
|
+
/// </summary>
|
|
118
|
+
member inline _.Source
|
|
119
|
+
(result: Task<Result<Option<'ok>, 'error>>)
|
|
120
|
+
: AsyncResultOption<'ok, 'error> =
|
|
121
|
+
result
|
|
122
|
+
|> Async.AwaitTask
|
|
123
|
+
#endif
|
|
124
|
+
let asyncResultOption = new AsyncResultOptionBuilder()
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
[<AutoOpen>]
|
|
128
|
+
module AsyncResultOptionCEExtensions =
|
|
129
|
+
|
|
130
|
+
type AsyncResultOptionBuilder with
|
|
131
|
+
|
|
132
|
+
/// <summary>
|
|
133
|
+
/// Needed to allow `for..in` and `for..do` functionality
|
|
134
|
+
/// </summary>
|
|
135
|
+
member inline _.Source(s: #seq<'value>) : #seq<'value> = s
|
|
136
|
+
|
|
137
|
+
/// <summary>
|
|
138
|
+
/// Method lets us transform data types into our internal representation.
|
|
139
|
+
/// </summary>
|
|
140
|
+
member inline _.Source(result: Result<'ok, 'error>) : AsyncResultOption<'ok, 'error> =
|
|
141
|
+
AsyncResultOption.ofResult result
|
|
142
|
+
|
|
143
|
+
/// <summary>
|
|
144
|
+
/// Method lets us transform data types into our internal representation.
|
|
145
|
+
/// </summary>
|
|
146
|
+
member inline this.Source(result: Choice<'ok, 'error>) : AsyncResultOption<'ok, 'error> =
|
|
147
|
+
this.Source(Result.ofChoice result)
|
|
148
|
+
|
|
149
|
+
/// <summary>
|
|
150
|
+
/// Method lets us transform data types into our internal representation.
|
|
151
|
+
/// </summary>
|
|
152
|
+
member inline this.Source(optional: Option<'ok>) : AsyncResultOption<'ok, 'error> =
|
|
153
|
+
AsyncResultOption.ofOption optional
|
|
154
|
+
|
|
155
|
+
/// <summary>
|
|
156
|
+
/// Method lets us transform data types into our internal representation.
|
|
157
|
+
/// </summary>
|
|
158
|
+
member inline this.Source(async: Async<'ok>) : AsyncResultOption<'ok, 'error> =
|
|
159
|
+
Async.map (Some >> Ok) async
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
member inline _.Using
|
|
163
|
+
(
|
|
164
|
+
resource: 'ok :> IDisposable,
|
|
165
|
+
[<InlineIfLambda>] binder: 'ok -> AsyncResultOption<'okOutput, 'error>
|
|
166
|
+
) : AsyncResultOption<'okOutput, 'error> =
|
|
167
|
+
async.Using(resource, binder)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
member inline this.For
|
|
171
|
+
(
|
|
172
|
+
sequence: #seq<'ok>,
|
|
173
|
+
[<InlineIfLambda>] binder: 'ok -> AsyncResultOption<unit, 'error>
|
|
174
|
+
) : AsyncResultOption<unit, 'error> =
|
|
175
|
+
this.Using(
|
|
176
|
+
sequence.GetEnumerator(),
|
|
177
|
+
fun enum ->
|
|
178
|
+
this.While(
|
|
179
|
+
(fun () -> enum.MoveNext()),
|
|
180
|
+
this.Delay(fun () -> binder enum.Current)
|
|
181
|
+
)
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
#if !FABLE_COMPILER
|
|
186
|
+
/// <summary>
|
|
187
|
+
/// Method lets us transform data types into our internal representation.
|
|
188
|
+
/// </summary>
|
|
189
|
+
member inline this.Source(async: Task<'ok>) : AsyncResultOption<'ok, 'error> =
|
|
190
|
+
async
|
|
191
|
+
|> Async.AwaitTask
|
|
192
|
+
|> Async.map (Some >> Ok)
|
|
193
|
+
|
|
194
|
+
/// <summary>
|
|
195
|
+
/// Method lets us transform data types into our internal representation.
|
|
196
|
+
/// </summary>
|
|
197
|
+
member inline this.Source(async: Task) : AsyncResultOption<unit, 'error> =
|
|
198
|
+
async
|
|
199
|
+
|> Async.AwaitTask
|
|
200
|
+
|> Async.map (Some >> Ok)
|
|
201
|
+
#endif
|
|
202
|
+
[<AutoOpen>]
|
|
203
|
+
module AsyncResultOptionCEExtensionsHighPriority =
|
|
204
|
+
|
|
205
|
+
type AsyncResultOptionBuilder with
|
|
206
|
+
|
|
207
|
+
/// <summary>
|
|
208
|
+
/// Method lets us transform data types into our internal representation.
|
|
209
|
+
/// </summary>
|
|
210
|
+
member inline _.Source
|
|
211
|
+
(result: Async<Result<'ok, 'error>>)
|
|
212
|
+
: AsyncResultOption<'ok, 'error> =
|
|
213
|
+
AsyncResultOption.ofAsyncResult result
|
|
214
|
+
|
|
215
|
+
/// <summary>
|
|
216
|
+
/// Method lets us transform data types into our internal representation.
|
|
217
|
+
/// </summary>
|
|
218
|
+
member inline _.Source(result: Async<Option<'ok>>) : AsyncResultOption<'ok, 'error> =
|
|
219
|
+
AsyncResultOption.ofAsyncOption result
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
#if !FABLE_COMPILER
|
|
223
|
+
/// <summary>
|
|
224
|
+
/// Method lets us transform data types into our internal representation.
|
|
225
|
+
/// </summary>
|
|
226
|
+
member inline _.Source(result: Task<Result<'ok, 'error>>) : AsyncResultOption<'ok, 'error> =
|
|
227
|
+
result
|
|
228
|
+
|> Async.AwaitTask
|
|
229
|
+
|> AsyncResultOption.ofAsyncResult
|
|
230
|
+
|
|
231
|
+
/// <summary>
|
|
232
|
+
/// Method lets us transform data types into our internal representation.
|
|
233
|
+
/// </summary>
|
|
234
|
+
member inline _.Source(result: Task<Option<'ok>>) : AsyncResultOption<'ok, 'error> =
|
|
235
|
+
result
|
|
236
|
+
|> Async.AwaitTask
|
|
237
|
+
|> AsyncResultOption.ofAsyncOption
|
|
238
|
+
#endif
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { class_type } from "../fable-library-js.4.14.0/Reflection.js";
|
|
2
|
+
|
|
3
|
+
export class AsyncResultOptionCE_AsyncResultOptionBuilder {
|
|
4
|
+
constructor() {
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function AsyncResultOptionCE_AsyncResultOptionBuilder_$reflection() {
|
|
9
|
+
return class_type("FsToolkit.ErrorHandling.AsyncResultOptionCE.AsyncResultOptionBuilder", void 0, AsyncResultOptionCE_AsyncResultOptionBuilder);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function AsyncResultOptionCE_AsyncResultOptionBuilder_$ctor() {
|
|
13
|
+
return new AsyncResultOptionCE_AsyncResultOptionBuilder();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const AsyncResultOptionCE_asyncResultOption = AsyncResultOptionCE_AsyncResultOptionBuilder_$ctor();
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=AsyncResultOptionCE.fs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["./AsyncResultOptionCE.fs"],"names":["\u0060\u0060.ctor\u0060\u0060"],"mappings":";;;;;;;;;;;;;;;qDA2H4B,AAAAA","file":null,"sourcesContent":null,"sourceRoot":null}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
namespace FsToolkit.ErrorHandling.Operator.AsyncResultOption
|
|
2
|
+
|
|
3
|
+
open FsToolkit.ErrorHandling
|
|
4
|
+
|
|
5
|
+
[<AutoOpen>]
|
|
6
|
+
module AsyncResultOption =
|
|
7
|
+
|
|
8
|
+
let inline (<!>)
|
|
9
|
+
([<InlineIfLambda>] mapper: 'okInput -> 'okOutput)
|
|
10
|
+
(input: Async<Result<'okInput option, 'error>>)
|
|
11
|
+
: Async<Result<'okOutput option, 'error>> =
|
|
12
|
+
AsyncResultOption.map mapper input
|
|
13
|
+
|
|
14
|
+
let inline (<*>)
|
|
15
|
+
(applier: Async<Result<('okInput -> 'okOutput) option, 'error>>)
|
|
16
|
+
(input: Async<Result<'okInput option, 'error>>)
|
|
17
|
+
: Async<Result<'okOutput option, 'error>> =
|
|
18
|
+
AsyncResultOption.apply applier input
|
|
19
|
+
|
|
20
|
+
let inline (>>=)
|
|
21
|
+
(input: Async<Result<'okInput option, 'error>>)
|
|
22
|
+
([<InlineIfLambda>] binder: 'okInput -> Async<Result<'okOutput option, 'error>>)
|
|
23
|
+
: Async<Result<'okOutput option, 'error>> =
|
|
24
|
+
AsyncResultOption.bind binder input
|