@glutinum/cli 0.13.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.
- package/README.md +19 -1
- package/dist/Glutinum.Converter/Abbreviations.js +246 -0
- package/dist/Glutinum.Converter/FsharpAST.js +87 -28
- package/dist/Glutinum.Converter/Generate.js +55 -8
- package/dist/Glutinum.Converter/GlueAST.js +333 -34
- package/dist/Glutinum.Converter/Log.js +7 -8
- package/dist/Glutinum.Converter/Merge.js +683 -31
- package/dist/Glutinum.Converter/Packages.js +308 -0
- package/dist/Glutinum.Converter/Printer.js +323 -186
- package/dist/Glutinum.Converter/Read.js +279 -6
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +13 -7
- package/dist/Glutinum.Converter/Reader/Declaration.js +102 -17
- package/dist/Glutinum.Converter/Reader/Documentation.js +168 -73
- package/dist/Glutinum.Converter/Reader/EnumDeclaration.js +7 -51
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +64 -15
- package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +165 -0
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +30 -5
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +122 -4
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +83 -7
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +8 -8
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +11 -9
- package/dist/Glutinum.Converter/Reader/NamedTupleMember.js +3 -2
- package/dist/Glutinum.Converter/Reader/Node.js +24 -10
- package/dist/Glutinum.Converter/Reader/Parameters.js +110 -7
- package/dist/Glutinum.Converter/Reader/Report.js +31 -12
- package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +4 -3
- package/dist/Glutinum.Converter/Reader/TypeNode.js +1524 -253
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +75 -20
- package/dist/Glutinum.Converter/Reader/TypeParameters.js +8 -5
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +184 -50
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +32 -13
- package/dist/Glutinum.Converter/Reader/Types.js +180 -0
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +99 -43
- package/dist/Glutinum.Converter/Reader/Utils.js +1143 -55
- package/dist/Glutinum.Converter/Reader/VariableStatement.js +59 -14
- package/dist/Glutinum.Converter/Transform.js +8292 -1119
- package/dist/Glutinum.Converter/TypeScript.Extensions.js +3 -3
- package/dist/Glutinum.Converter/TypeScript.js +3 -3
- package/dist/Glutinum.Converter/Utils/Keywords.js +6 -6
- package/dist/Glutinum.Converter/Utils/List.js +3 -3
- package/dist/Glutinum.Converter/Utils/Naming.js +61 -12
- package/dist/Glutinum.Converter/Utils/String.js +7 -3
- package/dist/Program.js +230 -72
- package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs +89 -0
- package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/AsyncIterable.fs.js +29 -29
- package/dist/fable_modules/Fable.Promise.3.2.1/Fable.Promise.fableproj +25 -0
- package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/Promise.fs +842 -766
- package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/Promise.fs.js +26 -12
- package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/PromiseImpl.fs +31 -31
- package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/PromiseImpl.fs.js +5 -5
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs +235 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs.js +384 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AssemblyInfo.fs +4 -4
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Async.fs +89 -9
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Async.fs.js +13 -12
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncOption.fs +50 -4
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncOptionCE.fs +30 -39
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncOptionCE.fs.js +10 -10
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResult.fs +52 -8
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultCE.fs +26 -42
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultCE.fs.js +3 -3
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOption.fs +17 -5
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs.js +26 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOptionCE.fs +31 -33
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOptionCE.fs.js +3 -3
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncValidation.fs +1 -6
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncValidationCE.fs +10 -18
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncValidationCE.fs.js +3 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/FsToolkit.ErrorHandling.fableproj +69 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/List.fs +68 -10
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/List.fs.js +47 -41
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Nullness.fs +81 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Option.fs +133 -2
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs +139 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs.js +48 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/OptionOp.fs +3 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs +88 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs.js +30 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs +200 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidation.fs +34 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs +244 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs.js +18 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Result.fs +87 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Result.fs.js +8 -8
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultCE.fs +8 -23
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultCE.fs.js +5 -5
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOption.fs +1 -1
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOption.fs.js +10 -10
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOptionCE.fs +7 -18
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOptionCE.fs.js +3 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs +503 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs.js +295 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Validation.fs +0 -5
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ValidationCE.fs +7 -13
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ValidationCE.fs.js +3 -3
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ValueOption.fs +1 -4
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOption.fs +102 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOptionCE.fs +587 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOptionOp.fs +10 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Debug/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +3 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0/obj/Release/netstandard2.1 → FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0}/FsToolkit.ErrorHandling.AssemblyInfo.fs +4 -4
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Release/netstandard2.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +4 -4
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Array.js +192 -86
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Async.js +58 -53
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/AsyncBuilder.js +29 -8
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/BigInt.js +71 -46
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/BitConverter.js +2 -2
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Boolean.js +4 -3
- package/dist/fable_modules/fable-library-js.5.17.2/CHANGELOG.md +348 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Char.js +64 -31
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Choice.js +2 -2
- package/dist/fable_modules/fable-library-js.5.17.2/CollectionUtil.js +182 -0
- package/dist/fable_modules/fable-library-js.5.17.2/ConditionalWeakTable.js +21 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Date.js +197 -112
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/DateOffset.js +46 -62
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/DateOnly.js +6 -6
- package/dist/fable_modules/fable-library-js.5.17.2/DateOnlyTemporal.js +146 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateTimeFormat.js +523 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateTimeOffsetTemporal.js +283 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateTimeTemporal.js +243 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Decimal.js +39 -13
- package/dist/fable_modules/fable-library-js.5.17.2/Directory.js +11 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Double.js +10 -3
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Encoding.js +20 -8
- package/dist/fable_modules/fable-library-js.5.17.2/Environment.js +3 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Event.js +10 -1
- package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Collections.js +45 -0
- package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Core.js +156 -0
- package/dist/fable_modules/fable-library-js.5.17.2/File.js +27 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Global.js +29 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Guid.js +33 -12
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Int32.js +17 -17
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/List.js +170 -106
- package/dist/fable_modules/fable-library-js.5.17.2/Long.js +38 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/MailboxProcessor.js +13 -6
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Map.js +65 -61
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/MapUtil.js +22 -4
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/MutableMap.js +28 -16
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/MutableSet.js +7 -7
- package/dist/fable_modules/fable-library-js.5.17.2/Native.js +14 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Numeric.js +44 -3
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Observable.js +5 -3
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Option.js +11 -20
- package/dist/fable_modules/fable-library-js.5.17.2/Path.js +31 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Random.js +22 -20
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Range.js +12 -12
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Reflection.js +50 -22
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/RegExp.js +68 -30
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Result.js +6 -6
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Seq.js +229 -104
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Seq2.js +1 -1
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Set.js +153 -113
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/String.js +238 -50
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/System.Collections.Generic.js +30 -14
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/System.Text.js +69 -31
- package/dist/fable_modules/fable-library-js.5.17.2/System.js +289 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Task.js +27 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TaskBuilder.js +72 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/TimeOnly.js +6 -6
- package/dist/fable_modules/fable-library-js.5.17.2/TimeOnlyTemporal.js +142 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/TimeSpan.js +18 -15
- package/dist/fable_modules/fable-library-js.5.17.2/TimeSpanTemporal.js +259 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Types.js +14 -24
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Uri.js +44 -21
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Util.js +49 -12
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/lib/big.js +14 -11
- package/dist/fable_modules/fable-library-js.5.17.2/package.json +24 -0
- package/dist/fable_modules/fable-library-js.5.17.2/quotation.js +682 -0
- package/package.json +4 -4
- package/src/Glutinum.Converter/js/bootstrap.js +109 -2
- package/src/Glutinum.Converter/js/host.js +144 -0
- package/src/Glutinum.Converter/js/npm.js +137 -0
- package/src/Glutinum.Converter/js/resolve.js +402 -0
- package/dist/Glutinum.Converter/FsharpAST.js.map +0 -1
- package/dist/Glutinum.Converter/Generate.js.map +0 -1
- package/dist/Glutinum.Converter/GlueAST.js.map +0 -1
- package/dist/Glutinum.Converter/Log.js.map +0 -1
- package/dist/Glutinum.Converter/Merge.js.map +0 -1
- package/dist/Glutinum.Converter/Printer.js.map +0 -1
- package/dist/Glutinum.Converter/Read.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Declaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Documentation.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/EnumDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/NamedTupleMember.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Node.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Parameters.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Report.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeNode.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeParameters.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Utils.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/VariableStatement.js.map +0 -1
- package/dist/Glutinum.Converter/Transform.js.map +0 -1
- package/dist/Glutinum.Converter/TypeScript.Extensions.js.map +0 -1
- package/dist/Glutinum.Converter/TypeScript.js.map +0 -1
- package/dist/Glutinum.Converter/Utils/Keywords.js.map +0 -1
- package/dist/Glutinum.Converter/Utils/List.js.map +0 -1
- package/dist/Glutinum.Converter/Utils/Naming.js.map +0 -1
- package/dist/Glutinum.Converter/Utils/String.js.map +0 -1
- package/dist/Program.js.map +0 -1
- package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs +0 -57
- package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js.map +0 -1
- package/dist/fable_modules/Fable.Promise.3.2.0/Fable.Promise.fableproj +0 -20
- package/dist/fable_modules/Fable.Promise.3.2.0/Promise.fs.js.map +0 -1
- package/dist/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Async.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOptionCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOption.fs.js +0 -26
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOption.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOptionCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidationCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/FsToolkit.ErrorHandling.fableproj +0 -51
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/List.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs +0 -186
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs.js +0 -18
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Result.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOption.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOptionCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs +0 -19
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs.js +0 -31
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs +0 -22
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs.js +0 -18
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValidationCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValueOptionCE.fs +0 -165
- package/dist/fable_modules/fable-library-js.4.14.0/Array.d.ts +0 -123
- package/dist/fable_modules/fable-library-js.4.14.0/Async.d.ts +0 -32
- package/dist/fable_modules/fable-library-js.4.14.0/AsyncBuilder.d.ts +0 -59
- package/dist/fable_modules/fable-library-js.4.14.0/BigInt.d.ts +0 -115
- package/dist/fable_modules/fable-library-js.4.14.0/BitConverter.d.ts +0 -27
- package/dist/fable_modules/fable-library-js.4.14.0/Boolean.d.ts +0 -3
- package/dist/fable_modules/fable-library-js.4.14.0/CHANGELOG.md +0 -37
- package/dist/fable_modules/fable-library-js.4.14.0/Char.d.ts +0 -65
- package/dist/fable_modules/fable-library-js.4.14.0/Choice.d.ts +0 -121
- package/dist/fable_modules/fable-library-js.4.14.0/Date.d.ts +0 -70
- package/dist/fable_modules/fable-library-js.4.14.0/DateOffset.d.ts +0 -63
- package/dist/fable_modules/fable-library-js.4.14.0/DateOnly.d.ts +0 -18
- package/dist/fable_modules/fable-library-js.4.14.0/Decimal.d.ts +0 -45
- package/dist/fable_modules/fable-library-js.4.14.0/Double.d.ts +0 -11
- package/dist/fable_modules/fable-library-js.4.14.0/Encoding.d.ts +0 -12
- package/dist/fable_modules/fable-library-js.4.14.0/Event.d.ts +0 -31
- package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Collections.d.ts +0 -7
- package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Collections.js +0 -27
- package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.CompilerServices.d.ts +0 -12
- package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.d.ts +0 -17
- package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.js +0 -69
- package/dist/fable_modules/fable-library-js.4.14.0/Global.d.ts +0 -24
- package/dist/fable_modules/fable-library-js.4.14.0/Global.js +0 -8
- package/dist/fable_modules/fable-library-js.4.14.0/Guid.d.ts +0 -10
- package/dist/fable_modules/fable-library-js.4.14.0/Int32.d.ts +0 -28
- package/dist/fable_modules/fable-library-js.4.14.0/List.d.ts +0 -143
- package/dist/fable_modules/fable-library-js.4.14.0/Long.d.ts +0 -3
- package/dist/fable_modules/fable-library-js.4.14.0/Long.js +0 -46
- package/dist/fable_modules/fable-library-js.4.14.0/MailboxProcessor.d.ts +0 -25
- package/dist/fable_modules/fable-library-js.4.14.0/Map.d.ts +0 -178
- package/dist/fable_modules/fable-library-js.4.14.0/MapUtil.d.ts +0 -10
- package/dist/fable_modules/fable-library-js.4.14.0/MutableMap.d.ts +0 -52
- package/dist/fable_modules/fable-library-js.4.14.0/MutableSet.d.ts +0 -39
- package/dist/fable_modules/fable-library-js.4.14.0/Native.d.ts +0 -2
- package/dist/fable_modules/fable-library-js.4.14.0/Native.js +0 -8
- package/dist/fable_modules/fable-library-js.4.14.0/Numeric.d.ts +0 -19
- package/dist/fable_modules/fable-library-js.4.14.0/Observable.d.ts +0 -32
- package/dist/fable_modules/fable-library-js.4.14.0/Option.d.ts +0 -28
- package/dist/fable_modules/fable-library-js.4.14.0/Random.d.ts +0 -37
- package/dist/fable_modules/fable-library-js.4.14.0/Range.d.ts +0 -12
- package/dist/fable_modules/fable-library-js.4.14.0/Reflection.d.ts +0 -119
- package/dist/fable_modules/fable-library-js.4.14.0/RegExp.d.ts +0 -10
- package/dist/fable_modules/fable-library-js.4.14.0/Result.d.ts +0 -37
- package/dist/fable_modules/fable-library-js.4.14.0/Seq.d.ts +0 -165
- package/dist/fable_modules/fable-library-js.4.14.0/Seq2.d.ts +0 -18
- package/dist/fable_modules/fable-library-js.4.14.0/Set.d.ts +0 -190
- package/dist/fable_modules/fable-library-js.4.14.0/String.d.ts +0 -50
- package/dist/fable_modules/fable-library-js.4.14.0/System.Collections.Generic.d.ts +0 -79
- package/dist/fable_modules/fable-library-js.4.14.0/System.Text.d.ts +0 -38
- package/dist/fable_modules/fable-library-js.4.14.0/SystemException.d.ts +0 -5
- package/dist/fable_modules/fable-library-js.4.14.0/SystemException.js +0 -5
- package/dist/fable_modules/fable-library-js.4.14.0/TimeOnly.d.ts +0 -15
- package/dist/fable_modules/fable-library-js.4.14.0/TimeSpan.d.ts +0 -34
- package/dist/fable_modules/fable-library-js.4.14.0/Timer.d.ts +0 -19
- package/dist/fable_modules/fable-library-js.4.14.0/Types.d.ts +0 -58
- package/dist/fable_modules/fable-library-js.4.14.0/Unicode.13.0.0.d.ts +0 -2
- package/dist/fable_modules/fable-library-js.4.14.0/Uri.d.ts +0 -29
- package/dist/fable_modules/fable-library-js.4.14.0/Util.d.ts +0 -207
- package/dist/fable_modules/fable-library-js.4.14.0/lib/big.d.ts +0 -5
- package/dist/fable_modules/fable-library-js.4.14.0/package.json +0 -24
- package/dist/fable_modules/project_cracked.json +0 -1
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncOptionOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOptionOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncValidationOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOptionOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ValidationOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Release/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +0 -0
- /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/FSharp.Core.CompilerServices.js +0 -0
- /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/README.md +0 -0
- /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Timer.js +0 -0
- /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Unicode.13.0.0.js +0 -0
- /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/big.d.ts +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
|
|
2
|
+
import { Result_MapError, Result_Map, FSharpResult$2 } from "../fable-library-js.5.17.2/Result.js";
|
|
3
|
+
import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
|
|
4
|
+
import { disposeSafe, getEnumerator } from "../fable-library-js.5.17.2/Util.js";
|
|
5
|
+
import { Operators_IsNull } from "../fable-library-js.5.17.2/FSharp.Core.js";
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* This is an identity function, it calls the given function and return the promise value untouched.
|
|
@@ -45,7 +47,7 @@ export function tap(fn, a) {
|
|
|
45
47
|
* </example>
|
|
46
48
|
*/
|
|
47
49
|
export function result(a) {
|
|
48
|
-
return a.then((ResultValue) => (new FSharpResult$2(0, [ResultValue]))).catch((ErrorValue) => (new FSharpResult$2(1, [ErrorValue])));
|
|
50
|
+
return a.then((ResultValue) => (new FSharpResult$2(/* Ok */ 0, [ResultValue]))).catch((ErrorValue) => (new FSharpResult$2(/* Error */ 1, [ErrorValue])));
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
/**
|
|
@@ -90,11 +92,11 @@ export function mapResult(fn, a) {
|
|
|
90
92
|
export function bindResult(fn, a) {
|
|
91
93
|
return a.then((a_1) => {
|
|
92
94
|
if (a_1.tag === 1) {
|
|
93
|
-
return Promise.resolve(new FSharpResult$2(1, [a_1.fields[0]]));
|
|
95
|
+
return Promise.resolve(new FSharpResult$2(/* Error */ 1, [a_1.fields[0]]));
|
|
94
96
|
}
|
|
95
97
|
else {
|
|
96
98
|
const pr = fn(a_1.fields[0]);
|
|
97
|
-
return pr.then((ResultValue) => (new FSharpResult$2(0, [ResultValue])));
|
|
99
|
+
return pr.then((ResultValue) => (new FSharpResult$2(/* Ok */ 0, [ResultValue])));
|
|
98
100
|
}
|
|
99
101
|
});
|
|
100
102
|
}
|
|
@@ -118,13 +120,26 @@ export function mapResultError(fn, a) {
|
|
|
118
120
|
return a.then((result_1) => Result_MapError(fn, result_1));
|
|
119
121
|
}
|
|
120
122
|
|
|
123
|
+
/**
|
|
124
|
+
* A builder to provide promise Computation Expression support.
|
|
125
|
+
*
|
|
126
|
+
* The CE is available via <c>promise { ... }</c>
|
|
127
|
+
* <example>
|
|
128
|
+
* <code lang="fsharp">
|
|
129
|
+
* let double (value : int) =
|
|
130
|
+
* promise {
|
|
131
|
+
* return value * 2
|
|
132
|
+
* }
|
|
133
|
+
* </code>
|
|
134
|
+
* </example>
|
|
135
|
+
*/
|
|
121
136
|
export class PromiseBuilder {
|
|
122
137
|
constructor() {
|
|
123
138
|
}
|
|
124
139
|
}
|
|
125
140
|
|
|
126
141
|
export function PromiseBuilder_$reflection() {
|
|
127
|
-
return class_type("Promise.PromiseBuilder",
|
|
142
|
+
return class_type("Promise.PromiseBuilder", undefined, PromiseBuilder);
|
|
128
143
|
}
|
|
129
144
|
|
|
130
145
|
export function PromiseBuilder_$ctor() {
|
|
@@ -132,11 +147,11 @@ export function PromiseBuilder_$ctor() {
|
|
|
132
147
|
}
|
|
133
148
|
|
|
134
149
|
export function PromiseBuilder__For_1565554B(_, seq, body) {
|
|
135
|
-
let
|
|
136
|
-
let p = Promise.resolve(void 0);
|
|
150
|
+
let p = Promise.resolve(undefined);
|
|
137
151
|
const enumerator = getEnumerator(seq);
|
|
138
152
|
try {
|
|
139
153
|
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
154
|
+
let pr;
|
|
140
155
|
const a = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
141
156
|
p = ((pr = p, pr.then(() => body(a))));
|
|
142
157
|
}
|
|
@@ -152,7 +167,7 @@ export function PromiseBuilder__While_2044D34(this$, guard, p) {
|
|
|
152
167
|
return p.then(() => PromiseBuilder__While_2044D34(this$, guard, p));
|
|
153
168
|
}
|
|
154
169
|
else {
|
|
155
|
-
return Promise.resolve(
|
|
170
|
+
return Promise.resolve(undefined);
|
|
156
171
|
}
|
|
157
172
|
}
|
|
158
173
|
|
|
@@ -173,7 +188,7 @@ export function PromiseBuilder__Delay_62FBFDE1(_, generator) {
|
|
|
173
188
|
return generator().then(onSuccess, onError);
|
|
174
189
|
}
|
|
175
190
|
catch (er) {
|
|
176
|
-
if (onError
|
|
191
|
+
if (Operators_IsNull(onError)) {
|
|
177
192
|
return Promise.reject(er);
|
|
178
193
|
}
|
|
179
194
|
else {
|
|
@@ -215,4 +230,3 @@ export function PromiseBuilder__Using_74F7E79D(this$, resource, binder) {
|
|
|
215
230
|
});
|
|
216
231
|
}
|
|
217
232
|
|
|
218
|
-
//# sourceMappingURL=Promise.fs.js.map
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
[<AutoOpen>]
|
|
2
|
-
module PromiseImpl
|
|
3
|
-
|
|
4
|
-
let promise = Promise.PromiseBuilder()
|
|
5
|
-
|
|
6
|
-
[<RequireQualifiedAccess>]
|
|
7
|
-
module SettledValue =
|
|
8
|
-
|
|
9
|
-
/// <summary>
|
|
10
|
-
/// Helper functionm to convert a settled result into an F# result
|
|
11
|
-
/// </summary>
|
|
12
|
-
/// <param name="p">The settled result</param>
|
|
13
|
-
/// <typeparam name="'T"></typeparam>
|
|
14
|
-
/// <returns>The F# result</returns>
|
|
15
|
-
/// <example>
|
|
16
|
-
/// <code lang="fsharp">
|
|
17
|
-
/// Promise.allSettled [success; rejection]
|
|
18
|
-
/// |> Promise.iter (fun results ->
|
|
19
|
-
/// for result in results do
|
|
20
|
-
/// match SettledValue.toResult result with
|
|
21
|
-
/// | Ok value ->
|
|
22
|
-
/// printfn "Success: %A" value
|
|
23
|
-
/// | Error err ->
|
|
24
|
-
/// eprintfn "Error: %O" err
|
|
25
|
-
/// )
|
|
26
|
-
/// </code>
|
|
27
|
-
/// </example>
|
|
28
|
-
let toResult (p: Promise.SettledValue<'T>) =
|
|
29
|
-
match p.status with
|
|
30
|
-
| Promise.Fulfilled -> Ok p.value.Value
|
|
31
|
-
| Promise.Rejected -> Error p.reason.Value
|
|
1
|
+
[<AutoOpen>]
|
|
2
|
+
module PromiseImpl
|
|
3
|
+
|
|
4
|
+
let promise = Promise.PromiseBuilder()
|
|
5
|
+
|
|
6
|
+
[<RequireQualifiedAccess>]
|
|
7
|
+
module SettledValue =
|
|
8
|
+
|
|
9
|
+
/// <summary>
|
|
10
|
+
/// Helper functionm to convert a settled result into an F# result
|
|
11
|
+
/// </summary>
|
|
12
|
+
/// <param name="p">The settled result</param>
|
|
13
|
+
/// <typeparam name="'T"></typeparam>
|
|
14
|
+
/// <returns>The F# result</returns>
|
|
15
|
+
/// <example>
|
|
16
|
+
/// <code lang="fsharp">
|
|
17
|
+
/// Promise.allSettled [success; rejection]
|
|
18
|
+
/// |> Promise.iter (fun results ->
|
|
19
|
+
/// for result in results do
|
|
20
|
+
/// match SettledValue.toResult result with
|
|
21
|
+
/// | Ok value ->
|
|
22
|
+
/// printfn "Success: %A" value
|
|
23
|
+
/// | Error err ->
|
|
24
|
+
/// eprintfn "Error: %O" err
|
|
25
|
+
/// )
|
|
26
|
+
/// </code>
|
|
27
|
+
/// </example>
|
|
28
|
+
let toResult (p: Promise.SettledValue<'T>) =
|
|
29
|
+
match p.status with
|
|
30
|
+
| Promise.Fulfilled -> Ok p.value.Value
|
|
31
|
+
| Promise.Rejected -> Error p.reason.Value
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
|
|
1
2
|
import { PromiseBuilder_$ctor } from "./Promise.fs.js";
|
|
2
|
-
import { value } from "../fable-library-js.
|
|
3
|
-
import { FSharpResult$2 } from "../fable-library-js.
|
|
3
|
+
import { value } from "../fable-library-js.5.17.2/Option.js";
|
|
4
|
+
import { FSharpResult$2 } from "../fable-library-js.5.17.2/Result.js";
|
|
4
5
|
|
|
5
6
|
export const promise = PromiseBuilder_$ctor();
|
|
6
7
|
|
|
@@ -10,11 +11,10 @@ export const promise = PromiseBuilder_$ctor();
|
|
|
10
11
|
export function SettledValue_toResult(p) {
|
|
11
12
|
const matchValue = p.status;
|
|
12
13
|
if (matchValue === "rejected") {
|
|
13
|
-
return new FSharpResult$2(1, [value(p.reason)]);
|
|
14
|
+
return new FSharpResult$2(/* Error */ 1, [value(p.reason)]);
|
|
14
15
|
}
|
|
15
16
|
else {
|
|
16
|
-
return new FSharpResult$2(0, [value(p.value)]);
|
|
17
|
+
return new FSharpResult$2(/* Ok */ 0, [value(p.value)]);
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
//# sourceMappingURL=PromiseImpl.fs.js.map
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
namespace FsToolkit.ErrorHandling
|
|
2
|
+
|
|
3
|
+
[<RequireQualifiedAccess>]
|
|
4
|
+
module Array =
|
|
5
|
+
let rec private traverseResultM' (state: Result<_, _>) (f: _ -> Result<_, _>) xs =
|
|
6
|
+
match xs with
|
|
7
|
+
| [||] ->
|
|
8
|
+
state
|
|
9
|
+
|> Result.map Array.rev
|
|
10
|
+
| arr ->
|
|
11
|
+
let x = Array.head arr
|
|
12
|
+
let xs = Array.skip 1 arr
|
|
13
|
+
|
|
14
|
+
let res =
|
|
15
|
+
result {
|
|
16
|
+
let! y = f x
|
|
17
|
+
let! ys = state
|
|
18
|
+
return Array.append [| y |] ys
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
match res with
|
|
22
|
+
| Ok _ -> traverseResultM' res f xs
|
|
23
|
+
| Error _ -> res
|
|
24
|
+
|
|
25
|
+
let rec private traverseAsyncResultM'
|
|
26
|
+
(state: Async<Result<_, _>>)
|
|
27
|
+
(f: _ -> Async<Result<_, _>>)
|
|
28
|
+
xs
|
|
29
|
+
=
|
|
30
|
+
match xs with
|
|
31
|
+
| [||] ->
|
|
32
|
+
state
|
|
33
|
+
|> AsyncResult.map Array.rev
|
|
34
|
+
| arr ->
|
|
35
|
+
let x = Array.head arr
|
|
36
|
+
let xs = Array.skip 1 arr
|
|
37
|
+
|
|
38
|
+
async {
|
|
39
|
+
let! r =
|
|
40
|
+
asyncResult {
|
|
41
|
+
let! ys = state
|
|
42
|
+
let! y = f x
|
|
43
|
+
return Array.append [| y |] ys
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
match r with
|
|
47
|
+
| Ok _ -> return! traverseAsyncResultM' (Async.singleton r) f xs
|
|
48
|
+
| Error _ -> return r
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let traverseResultM f xs = traverseResultM' (Ok [||]) f xs
|
|
52
|
+
|
|
53
|
+
let sequenceResultM xs = traverseResultM id xs
|
|
54
|
+
|
|
55
|
+
let traverseAsyncResultM f xs =
|
|
56
|
+
traverseAsyncResultM' (AsyncResult.ok [||]) f xs
|
|
57
|
+
|
|
58
|
+
let sequenceAsyncResultM xs = traverseAsyncResultM id xs
|
|
59
|
+
|
|
60
|
+
let rec private traverseResultA' state f xs =
|
|
61
|
+
match xs with
|
|
62
|
+
| [||] ->
|
|
63
|
+
state
|
|
64
|
+
|> Result.eitherMap Array.rev Array.rev
|
|
65
|
+
| arr ->
|
|
66
|
+
let x = Array.head arr
|
|
67
|
+
let xs = Array.skip 1 arr
|
|
68
|
+
|
|
69
|
+
match state, f x with
|
|
70
|
+
| Ok ys, Ok y -> traverseResultA' (Ok(Array.append [| y |] ys)) f xs
|
|
71
|
+
| Error errs, Error e -> traverseResultA' (Error(Array.append [| e |] errs)) f xs
|
|
72
|
+
| Ok _, Error e -> traverseResultA' (Error [| e |]) f xs
|
|
73
|
+
| Error e, Ok _ -> traverseResultA' (Error e) f xs
|
|
74
|
+
|
|
75
|
+
let rec private traverseAsyncResultA' state f xs =
|
|
76
|
+
match xs with
|
|
77
|
+
| [||] ->
|
|
78
|
+
state
|
|
79
|
+
|> AsyncResult.eitherMap Array.rev Array.rev
|
|
80
|
+
|
|
81
|
+
| arr ->
|
|
82
|
+
let x = Array.head arr
|
|
83
|
+
let xs = Array.skip 1 arr
|
|
84
|
+
|
|
85
|
+
async {
|
|
86
|
+
let! s = state
|
|
87
|
+
let! fR = f x
|
|
88
|
+
|
|
89
|
+
match s, fR with
|
|
90
|
+
| Ok ys, Ok y ->
|
|
91
|
+
return! traverseAsyncResultA' (AsyncResult.ok (Array.append [| y |] ys)) f xs
|
|
92
|
+
| Error errs, Error e ->
|
|
93
|
+
return!
|
|
94
|
+
traverseAsyncResultA' (AsyncResult.error (Array.append [| e |] errs)) f xs
|
|
95
|
+
| Ok _, Error e -> return! traverseAsyncResultA' (AsyncResult.error [| e |]) f xs
|
|
96
|
+
| Error e, Ok _ -> return! traverseAsyncResultA' (AsyncResult.error e) f xs
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
let traverseResultA f xs = traverseResultA' (Ok [||]) f xs
|
|
100
|
+
|
|
101
|
+
let sequenceResultA xs = traverseResultA id xs
|
|
102
|
+
|
|
103
|
+
let rec private traverseValidationA' state f xs =
|
|
104
|
+
match xs with
|
|
105
|
+
| [||] ->
|
|
106
|
+
state
|
|
107
|
+
|> Result.eitherMap Array.rev Array.rev
|
|
108
|
+
| arr ->
|
|
109
|
+
let x = Array.head arr
|
|
110
|
+
let xs = Array.skip 1 arr
|
|
111
|
+
let fR = f x
|
|
112
|
+
|
|
113
|
+
match state, fR with
|
|
114
|
+
| Ok ys, Ok y -> traverseValidationA' (Ok(Array.append [| y |] ys)) f xs
|
|
115
|
+
| Error errs1, Error errs2 ->
|
|
116
|
+
let errs = Array.append errs2 errs1
|
|
117
|
+
traverseValidationA' (Error errs) f xs
|
|
118
|
+
| Ok _, Error errs
|
|
119
|
+
| Error errs, Ok _ -> traverseValidationA' (Error errs) f xs
|
|
120
|
+
|
|
121
|
+
let traverseValidationA f xs = traverseValidationA' (Ok [||]) f xs
|
|
122
|
+
|
|
123
|
+
let sequenceValidationA xs = traverseValidationA id xs
|
|
124
|
+
|
|
125
|
+
let traverseAsyncResultA f xs =
|
|
126
|
+
traverseAsyncResultA' (AsyncResult.ok [||]) f xs
|
|
127
|
+
|
|
128
|
+
let sequenceAsyncResultA xs = traverseAsyncResultA id xs
|
|
129
|
+
|
|
130
|
+
let rec private traverseOptionM' (state: _ option) (f: _ -> _ option) xs =
|
|
131
|
+
match xs with
|
|
132
|
+
| [||] ->
|
|
133
|
+
state
|
|
134
|
+
|> Option.map Array.rev
|
|
135
|
+
| arr ->
|
|
136
|
+
let x = Array.head arr
|
|
137
|
+
let xs = Array.skip 1 arr
|
|
138
|
+
|
|
139
|
+
let r =
|
|
140
|
+
option {
|
|
141
|
+
let! y = f x
|
|
142
|
+
let! ys = state
|
|
143
|
+
return Array.append [| y |] ys
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
match r with
|
|
147
|
+
| Some _ -> traverseOptionM' r f xs
|
|
148
|
+
| None -> r
|
|
149
|
+
|
|
150
|
+
let rec private traverseAsyncOptionM' (state: Async<_ option>) (f: _ -> Async<_ option>) xs =
|
|
151
|
+
match xs with
|
|
152
|
+
| [||] ->
|
|
153
|
+
state
|
|
154
|
+
|> AsyncOption.map Array.rev
|
|
155
|
+
| arr ->
|
|
156
|
+
let x = Array.head arr
|
|
157
|
+
let xs = Array.skip 1 arr
|
|
158
|
+
|
|
159
|
+
async {
|
|
160
|
+
let! o =
|
|
161
|
+
asyncOption {
|
|
162
|
+
let! y = f x
|
|
163
|
+
let! ys = state
|
|
164
|
+
return Array.append [| y |] ys
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
match o with
|
|
168
|
+
| Some _ -> return! traverseAsyncOptionM' (Async.singleton o) f xs
|
|
169
|
+
| None -> return o
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/// <summary>
|
|
173
|
+
/// Applies the given function <paramref name="f"/> to each element in the input list <paramref name="xs"/>,
|
|
174
|
+
/// and returns an option containing a list of the results. If any of the function applications return None,
|
|
175
|
+
/// the entire result will be None.
|
|
176
|
+
/// </summary>
|
|
177
|
+
/// <param name="f">The function to apply to each element in the input list.</param>
|
|
178
|
+
/// <param name="xs">The input list.</param>
|
|
179
|
+
/// <returns>An option containing a list of the results of applying the function to each element in the input list,
|
|
180
|
+
/// or None if any of the function applications return None.</returns>
|
|
181
|
+
let traverseOptionM f xs = traverseOptionM' (Some [||]) f xs
|
|
182
|
+
|
|
183
|
+
/// <summary>
|
|
184
|
+
/// Applies the monadic function <paramref name="id"/> to each element in the input list <paramref name="xs"/>,
|
|
185
|
+
/// and returns the result as an option. If any element in the list is None, the entire result will be None.
|
|
186
|
+
/// </summary>
|
|
187
|
+
/// <param name="xs">The input list.</param>
|
|
188
|
+
/// <returns>An option containing the result of applying <paramref name="id"/> to each element in <paramref name="xs"/>.</returns>
|
|
189
|
+
let sequenceOptionM xs = traverseOptionM id xs
|
|
190
|
+
|
|
191
|
+
let traverseAsyncOptionM f xs =
|
|
192
|
+
traverseAsyncOptionM' (AsyncOption.some [||]) f xs
|
|
193
|
+
|
|
194
|
+
let sequenceAsyncOptionM xs = traverseAsyncOptionM id xs
|
|
195
|
+
|
|
196
|
+
#if !FABLE_COMPILER
|
|
197
|
+
let rec private traverseVOptionM' (state: voption<_>) (f: _ -> voption<_>) xs =
|
|
198
|
+
match xs with
|
|
199
|
+
| [||] ->
|
|
200
|
+
state
|
|
201
|
+
|> ValueOption.map Array.rev
|
|
202
|
+
| arr ->
|
|
203
|
+
let x = Array.head arr
|
|
204
|
+
let xs = Array.skip 1 arr
|
|
205
|
+
|
|
206
|
+
let r =
|
|
207
|
+
voption {
|
|
208
|
+
let! y = f x
|
|
209
|
+
let! ys = state
|
|
210
|
+
return Array.append [| y |] ys
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
match r with
|
|
214
|
+
| ValueSome _ -> traverseVOptionM' r f xs
|
|
215
|
+
| ValueNone -> r
|
|
216
|
+
|
|
217
|
+
/// <summary>
|
|
218
|
+
/// Applies the given function <paramref name="f"/> to each element in the input list <paramref name="xs"/>,
|
|
219
|
+
/// and returns an option containing a list of the results. If any of the function applications return ValueNone,
|
|
220
|
+
/// the entire result will be ValueNone.
|
|
221
|
+
/// </summary>
|
|
222
|
+
/// <param name="f">The function to apply to each element in the input list.</param>
|
|
223
|
+
/// <param name="xs">The input list</param>
|
|
224
|
+
/// <returns>An Option monad containing the collected results.</returns>
|
|
225
|
+
let traverseVOptionM f xs = traverseVOptionM' (ValueSome [||]) f xs
|
|
226
|
+
|
|
227
|
+
/// <summary>
|
|
228
|
+
/// Applies the <paramref name="id"/> function to each element in the input list <paramref name="xs"/>,
|
|
229
|
+
/// and returns the result as a value option. If any element in the list is ValueNone, the entire result will be ValueNone.
|
|
230
|
+
/// </summary>
|
|
231
|
+
/// <param name="xs">The input list.</param>
|
|
232
|
+
/// <returns>A <see cref="Option{T}"/> representing the sequence of results.</returns>
|
|
233
|
+
let sequenceVOptionM xs = traverseVOptionM id xs
|
|
234
|
+
|
|
235
|
+
#endif
|