@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
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
// See here for previous design discussions:
|
|
2
|
+
// 1. https://github.com/demystifyfp/FsToolkit.ErrorHandling/pull/277
|
|
3
|
+
// 2. https://github.com/demystifyfp/FsToolkit.ErrorHandling/pull/310
|
|
4
|
+
|
|
5
|
+
[<RequireQualifiedAccess>]
|
|
6
|
+
module FsToolkit.ErrorHandling.Seq
|
|
7
|
+
|
|
8
|
+
open Microsoft.FSharp.Core.CompilerServices
|
|
9
|
+
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// Applies a function to each element of a sequence and returns a single result
|
|
12
|
+
/// </summary>
|
|
13
|
+
/// <param name="state">The initial state</param>
|
|
14
|
+
/// <param name="f">The function to apply to each element</param>
|
|
15
|
+
/// <param name="xs">The input sequence</param>
|
|
16
|
+
/// <returns>If state and all elements in 'sequence' are Ok, a result with the elements in an array. Alternately, the first error encountered</returns>
|
|
17
|
+
let inline traverseResultM'
|
|
18
|
+
(state: Result<'okOutput seq, 'error>)
|
|
19
|
+
([<InlineIfLambda>] f: 'okInput -> Result<'okOutput, 'error>)
|
|
20
|
+
(xs: SeqNull<'okInput>)
|
|
21
|
+
: Result<'okOutput[], 'error> =
|
|
22
|
+
if isNull xs then
|
|
23
|
+
nullArg (nameof xs)
|
|
24
|
+
|
|
25
|
+
match state with
|
|
26
|
+
| Error e -> Error e
|
|
27
|
+
| Ok initialSuccesses ->
|
|
28
|
+
|
|
29
|
+
let oks = ResizeArray(initialSuccesses)
|
|
30
|
+
let mutable err = Unchecked.defaultof<'error>
|
|
31
|
+
let mutable ok = true
|
|
32
|
+
use e = xs.GetEnumerator()
|
|
33
|
+
|
|
34
|
+
while ok
|
|
35
|
+
&& e.MoveNext() do
|
|
36
|
+
match f e.Current with
|
|
37
|
+
| Ok r -> oks.Add r
|
|
38
|
+
| Error e ->
|
|
39
|
+
err <- e
|
|
40
|
+
ok <- false
|
|
41
|
+
|
|
42
|
+
if ok then Ok(oks.ToArray()) else Error err
|
|
43
|
+
|
|
44
|
+
/// <summary>
|
|
45
|
+
/// Applies a function to each element of a sequence and returns a single result
|
|
46
|
+
/// </summary>
|
|
47
|
+
/// <param name="f">The function to apply to each element</param>
|
|
48
|
+
/// <param name="xs">The input sequence</param>
|
|
49
|
+
/// <returns>A result with the ok elements in an array, or the first error occurring in the sequence</returns>
|
|
50
|
+
/// <remarks>This function is equivalent to <see cref="traverseResultM'"/> but applying an initial state of 'Seq.empty'</remarks>
|
|
51
|
+
let traverseResultM f xs = traverseResultM' (Ok Seq.empty) f xs
|
|
52
|
+
|
|
53
|
+
/// <summary>
|
|
54
|
+
/// Converts a sequence of results into a single result
|
|
55
|
+
/// </summary>
|
|
56
|
+
/// <param name="xs">The input sequence</param>
|
|
57
|
+
/// <returns>A result bearing all the results as an array, or the first error occurring in the sequence</returns>
|
|
58
|
+
/// <remarks>This function is equivalent to <see cref="traverseResultM"/> but auto-applying the 'id' function</remarks>
|
|
59
|
+
let sequenceResultM xs = traverseResultM id xs
|
|
60
|
+
|
|
61
|
+
/// <summary>
|
|
62
|
+
/// Applies a function to each element of a sequence and returns a single result
|
|
63
|
+
/// </summary>
|
|
64
|
+
/// <param name="state">The initial state</param>
|
|
65
|
+
/// <param name="f">The function to apply to each element</param>
|
|
66
|
+
/// <param name="xs">The input sequence</param>
|
|
67
|
+
/// <returns>If no Errors encountered, an Ok result bearing an array of the ok elements from the 'state' followed by those gathered from the sequence, or an Error bearing an array of all errors from the 'state' and/or those in the sequence</returns>
|
|
68
|
+
let inline traverseResultA'
|
|
69
|
+
(state: Result<'okOutput seq, 'error seq>)
|
|
70
|
+
([<InlineIfLambda>] f: 'okInput -> Result<'okOutput, 'error>)
|
|
71
|
+
(xs: SeqNull<'okInput>)
|
|
72
|
+
=
|
|
73
|
+
|
|
74
|
+
if isNull xs then
|
|
75
|
+
nullArg (nameof xs)
|
|
76
|
+
|
|
77
|
+
match state with
|
|
78
|
+
| Error failuresToDate ->
|
|
79
|
+
let errs = ResizeArray failuresToDate
|
|
80
|
+
|
|
81
|
+
for x in xs do
|
|
82
|
+
match f x with
|
|
83
|
+
| Error e -> errs.Add e
|
|
84
|
+
| Ok _ -> () // as the initial state was failure, oks are irrelevant
|
|
85
|
+
|
|
86
|
+
Error(errs.ToArray())
|
|
87
|
+
| Ok initialSuccesses ->
|
|
88
|
+
|
|
89
|
+
let oks = ResizeArray initialSuccesses
|
|
90
|
+
let errs = ResizeArray()
|
|
91
|
+
|
|
92
|
+
for x in xs do
|
|
93
|
+
match f x with
|
|
94
|
+
| Ok r when errs.Count = 0 -> oks.Add r
|
|
95
|
+
| Ok _ -> () // no point saving results we won't use given the end result will be Error
|
|
96
|
+
| Error e -> errs.Add e
|
|
97
|
+
|
|
98
|
+
if errs.Count = 0 then
|
|
99
|
+
Ok(oks.ToArray())
|
|
100
|
+
else
|
|
101
|
+
Error(errs.ToArray())
|
|
102
|
+
|
|
103
|
+
/// <summary>
|
|
104
|
+
/// Applies a function to each element of a sequence and returns a single result
|
|
105
|
+
/// </summary>
|
|
106
|
+
/// <param name="f">The function to apply to each element</param>
|
|
107
|
+
/// <param name="xs">The input sequence</param>
|
|
108
|
+
/// <returns>A result with the ok elements in an array or an array of all errors from the sequence</returns>
|
|
109
|
+
/// <remarks>This function is equivalent to <see cref="traverseResultA'"/> but applying an initial state of Seq.empty'</remarks>
|
|
110
|
+
let traverseResultA f xs = traverseResultA' (Ok Seq.empty) f xs
|
|
111
|
+
|
|
112
|
+
/// <summary>
|
|
113
|
+
/// Converts a sequence of results into a single result
|
|
114
|
+
/// </summary>
|
|
115
|
+
/// <param name="xs">The input sequence</param>
|
|
116
|
+
/// <returns>A result with the elements in an array or an array of all errors from the sequence</returns>
|
|
117
|
+
/// <remarks>This function is equivalent to <see cref="traverseResultA"/> but auto-applying the 'id' function</remarks>
|
|
118
|
+
let sequenceResultA xs = traverseResultA id xs
|
|
119
|
+
|
|
120
|
+
/// <summary>
|
|
121
|
+
/// Applies a function to each element of a sequence and returns a single async result
|
|
122
|
+
/// </summary>
|
|
123
|
+
/// <param name="state">The initial state</param>
|
|
124
|
+
/// <param name="f">The function to apply to each element</param>
|
|
125
|
+
/// <param name="xs">The input sequence</param>
|
|
126
|
+
/// <returns>An async result with the ok elements in an array or the first error encountered in the state or the sequence</returns>
|
|
127
|
+
let inline traverseAsyncResultM'
|
|
128
|
+
(state: Async<Result<'okOutput seq, 'error>>)
|
|
129
|
+
([<InlineIfLambda>] f: 'okInput -> Async<Result<'okOutput, 'error>>)
|
|
130
|
+
(xs: SeqNull<'okInput>)
|
|
131
|
+
: Async<Result<'okOutput[], 'error>> =
|
|
132
|
+
if isNull xs then
|
|
133
|
+
nullArg (nameof xs)
|
|
134
|
+
|
|
135
|
+
async {
|
|
136
|
+
match! state with
|
|
137
|
+
| Error e -> return Error e
|
|
138
|
+
| Ok initialSuccesses ->
|
|
139
|
+
let oks = ResizeArray initialSuccesses
|
|
140
|
+
let mutable err = Unchecked.defaultof<'error>
|
|
141
|
+
let mutable ok = true
|
|
142
|
+
use e = xs.GetEnumerator()
|
|
143
|
+
|
|
144
|
+
while ok
|
|
145
|
+
&& e.MoveNext() do
|
|
146
|
+
match! f e.Current with
|
|
147
|
+
| Ok r -> oks.Add r
|
|
148
|
+
| Error e ->
|
|
149
|
+
err <- e
|
|
150
|
+
ok <- false
|
|
151
|
+
|
|
152
|
+
return if ok then Ok(oks.ToArray()) else Error err
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/// <summary>
|
|
156
|
+
/// Applies a function to each element of a sequence and returns a single async result
|
|
157
|
+
/// </summary>
|
|
158
|
+
/// <param name="f">The function to apply to each element</param>
|
|
159
|
+
/// <param name="xs">The input sequence</param>
|
|
160
|
+
/// <returns>An async result with the ok elements in an array or the first error occurring in the sequence</returns>
|
|
161
|
+
/// <remarks>This function is equivalent to <see cref="traverseAsyncResultM'"/> but applying an initial state of 'Seq.empty'</remarks>
|
|
162
|
+
let traverseAsyncResultM f xs =
|
|
163
|
+
traverseAsyncResultM' (async { return Ok Seq.empty }) f xs
|
|
164
|
+
|
|
165
|
+
/// <summary>
|
|
166
|
+
/// Converts a sequence of async results into a single async result
|
|
167
|
+
/// </summary>
|
|
168
|
+
/// <param name="xs">The input sequence</param>
|
|
169
|
+
/// <returns>An async result with the ok elements in an array or the first error occurring in the sequence</returns>
|
|
170
|
+
/// <remarks>This function is equivalent to <see cref="traverseAsyncResultM"/> but auto-applying the 'id' function</remarks>
|
|
171
|
+
let sequenceAsyncResultM xs = traverseAsyncResultM id xs
|
|
172
|
+
|
|
173
|
+
#if !FABLE_COMPILER
|
|
174
|
+
/// <summary>
|
|
175
|
+
/// Applies a function to each element of a sequence and returns a single Task result
|
|
176
|
+
/// </summary>
|
|
177
|
+
/// <param name="state">The initial state</param>
|
|
178
|
+
/// <param name="f">The function to apply to each element</param>
|
|
179
|
+
/// <param name="xs">The input sequence</param>
|
|
180
|
+
/// <returns>A task result with the ok elements in an array or the first error encountered in the state or the sequence</returns>
|
|
181
|
+
let inline traverseTaskResultM'
|
|
182
|
+
(state: TaskResult<'okOutput seq, 'error>)
|
|
183
|
+
([<InlineIfLambda>] f: 'okInput -> TaskResult<'okOutput, 'error>)
|
|
184
|
+
(xs: SeqNull<'okInput>)
|
|
185
|
+
: TaskResult<'okOutput[], 'error> =
|
|
186
|
+
if isNull xs then
|
|
187
|
+
nullArg (nameof xs)
|
|
188
|
+
|
|
189
|
+
task {
|
|
190
|
+
match! state with
|
|
191
|
+
| Error e -> return Error e
|
|
192
|
+
| Ok initialSuccesses ->
|
|
193
|
+
let oks = ResizeArray initialSuccesses
|
|
194
|
+
let mutable err = Unchecked.defaultof<'error>
|
|
195
|
+
let mutable ok = true
|
|
196
|
+
use e = xs.GetEnumerator()
|
|
197
|
+
|
|
198
|
+
while ok
|
|
199
|
+
&& e.MoveNext() do
|
|
200
|
+
match! f e.Current with
|
|
201
|
+
| Ok r -> oks.Add r
|
|
202
|
+
| Error e ->
|
|
203
|
+
err <- e
|
|
204
|
+
ok <- false
|
|
205
|
+
|
|
206
|
+
return if ok then Ok(oks.ToArray()) else Error err
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/// <summary>
|
|
210
|
+
/// Applies a function to each element of a sequence and returns a single Task result
|
|
211
|
+
/// </summary>
|
|
212
|
+
/// <param name="f">The function to apply to each element</param>
|
|
213
|
+
/// <param name="xs">The input sequence</param>
|
|
214
|
+
/// <returns>A task result with the ok elements in an array or the first error occurring in the sequence</returns>
|
|
215
|
+
/// <remarks>This function is equivalent to <see cref="traverseTaskResultM'"/> but applying an initial state of 'Seq.empty'</remarks>
|
|
216
|
+
let traverseTaskResultM f xs =
|
|
217
|
+
traverseTaskResultM' (TaskResult.ok Seq.empty) f xs
|
|
218
|
+
|
|
219
|
+
/// <summary>
|
|
220
|
+
/// Converts a sequence of Task results into a single Task result
|
|
221
|
+
/// </summary>
|
|
222
|
+
/// <param name="xs">The input sequence</param>
|
|
223
|
+
/// <returns>A task result with the ok elements in an array or the first error occurring in the sequence</returns>
|
|
224
|
+
/// <remarks>This function is equivalent to <see cref="traverseTaskResultM"/> but auto-applying the 'id' function</remarks>
|
|
225
|
+
let sequenceTaskResultM xs = traverseTaskResultM id xs
|
|
226
|
+
|
|
227
|
+
#endif
|
|
228
|
+
|
|
229
|
+
/// <summary>
|
|
230
|
+
/// Applies a function to each element of a sequence and returns a single async result
|
|
231
|
+
/// </summary>
|
|
232
|
+
/// <param name="state">The initial state</param>
|
|
233
|
+
/// <param name="f">The function to apply to each element</param>
|
|
234
|
+
/// <param name="xs">The input sequence</param>
|
|
235
|
+
/// <returns>An async result with the ok elements in an array or an array of all errors from the state and the original sequence</returns>
|
|
236
|
+
let inline traverseAsyncResultA'
|
|
237
|
+
(state: Async<Result<'okOutput seq, 'error seq>>)
|
|
238
|
+
([<InlineIfLambda>] f: 'okInput -> Async<Result<'okOutput, 'error>>)
|
|
239
|
+
(xs: SeqNull<'okInput>)
|
|
240
|
+
: Async<Result<'okOutput[], 'error[]>> =
|
|
241
|
+
let xs = Nullness.nullArgCheck (nameof xs) xs
|
|
242
|
+
|
|
243
|
+
async {
|
|
244
|
+
match! state with
|
|
245
|
+
| Error failuresToDate ->
|
|
246
|
+
let errs = ResizeArray failuresToDate
|
|
247
|
+
|
|
248
|
+
for x in xs do
|
|
249
|
+
match! f x with
|
|
250
|
+
| Ok _ -> () // as the initial state was failure, oks are irrelevant
|
|
251
|
+
| Error e -> errs.Add e
|
|
252
|
+
|
|
253
|
+
return Error(errs.ToArray())
|
|
254
|
+
| Ok initialSuccesses ->
|
|
255
|
+
|
|
256
|
+
let oks = ResizeArray initialSuccesses
|
|
257
|
+
let errs = ResizeArray()
|
|
258
|
+
|
|
259
|
+
for x in xs do
|
|
260
|
+
match! f x with
|
|
261
|
+
| Ok r when errs.Count = 0 -> oks.Add r
|
|
262
|
+
| Ok _ -> () // no point saving results we won't use given the end result will be Error
|
|
263
|
+
| Error e -> errs.Add e
|
|
264
|
+
|
|
265
|
+
if errs.Count = 0 then
|
|
266
|
+
return Ok(oks.ToArray())
|
|
267
|
+
else
|
|
268
|
+
return Error(errs.ToArray())
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/// <summary>
|
|
272
|
+
/// Applies a function to each element of a sequence and returns a single async result
|
|
273
|
+
/// </summary>
|
|
274
|
+
/// <param name="f">The function to apply to each element</param>
|
|
275
|
+
/// <param name="xs">The input sequence</param>
|
|
276
|
+
/// <returns>An async result with the ok elements in an array or an array of all errors occuring in the sequence</returns>
|
|
277
|
+
/// <remarks>This function is equivalent to <see cref="traverseAsyncResultA'"/> but applying an initial state of 'Seq.empty'</remarks>
|
|
278
|
+
let traverseAsyncResultA f xs =
|
|
279
|
+
traverseAsyncResultA' (async { return Ok Seq.empty }) f xs
|
|
280
|
+
|
|
281
|
+
/// <summary>
|
|
282
|
+
/// Converts a sequence of async results into a single async result
|
|
283
|
+
/// </summary>
|
|
284
|
+
/// <param name="xs">The input sequence</param>
|
|
285
|
+
/// <returns>An async result with all ok elements in an array or an error result with an array of all errors occuring in the sequence</returns>
|
|
286
|
+
/// <remarks>This function is equivalent to <see cref="traverseAsyncResultA"/> but auto-applying the 'id' function</remarks>
|
|
287
|
+
let sequenceAsyncResultA xs = traverseAsyncResultA id xs
|
|
288
|
+
|
|
289
|
+
#if !FABLE_COMPILER
|
|
290
|
+
|
|
291
|
+
/// <summary>
|
|
292
|
+
/// Applies a function to each element of a sequence and returns a single task result
|
|
293
|
+
/// </summary>
|
|
294
|
+
/// <param name="state">The initial state</param>
|
|
295
|
+
/// <param name="f">The function to apply to each element</param>
|
|
296
|
+
/// <param name="xs">The input sequence</param>
|
|
297
|
+
/// <returns>A task result with the ok elements in an array or an array of all errors from the state and the original sequence</returns>
|
|
298
|
+
let inline traverseTaskResultA'
|
|
299
|
+
(state: TaskResult<'okOutput seq, 'error seq>)
|
|
300
|
+
([<InlineIfLambda>] f: 'okInput -> TaskResult<'okOutput, 'error>)
|
|
301
|
+
(xs: SeqNull<'okInput>)
|
|
302
|
+
: TaskResult<'okOutput[], 'error[]> =
|
|
303
|
+
let xs = Nullness.nullArgCheck (nameof xs) xs
|
|
304
|
+
|
|
305
|
+
task {
|
|
306
|
+
match! state with
|
|
307
|
+
| Error failuresToDate ->
|
|
308
|
+
let mutable errs = ArrayCollector()
|
|
309
|
+
errs.AddMany failuresToDate
|
|
310
|
+
|
|
311
|
+
for x in xs do
|
|
312
|
+
match! f x with
|
|
313
|
+
| Ok _ -> () // as the initial state was failure, oks are irrelevant
|
|
314
|
+
| Error e -> errs.Add e
|
|
315
|
+
|
|
316
|
+
return Error(errs.Close())
|
|
317
|
+
| Ok initialSuccesses ->
|
|
318
|
+
|
|
319
|
+
let mutable oks = ArrayCollector()
|
|
320
|
+
oks.AddMany initialSuccesses
|
|
321
|
+
let mutable ok = true
|
|
322
|
+
let mutable errs = ArrayCollector()
|
|
323
|
+
|
|
324
|
+
for x in xs do
|
|
325
|
+
match! f x with
|
|
326
|
+
| Ok r when ok -> oks.Add r
|
|
327
|
+
| Ok _ -> () // no point saving results we won't use given the end result will be Error
|
|
328
|
+
| Error e ->
|
|
329
|
+
errs.Add e
|
|
330
|
+
ok <- false
|
|
331
|
+
|
|
332
|
+
return if ok then Ok(oks.Close()) else Error(errs.Close())
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/// <summary>
|
|
336
|
+
/// Applies a function to each element of a sequence and returns a single task result
|
|
337
|
+
/// </summary>
|
|
338
|
+
/// <param name="f">The function to apply to each element</param>
|
|
339
|
+
/// <param name="xs">The input sequence</param>
|
|
340
|
+
/// <returns>A task result with the ok elements in an array or an array of all errors occuring in the sequence</returns>
|
|
341
|
+
/// <remarks>This function is equivalent to <see cref="traverseTaskResultA'"/> but applying an initial state of 'Seq.empty'</remarks>
|
|
342
|
+
let traverseTaskResultA f xs =
|
|
343
|
+
traverseTaskResultA' (TaskResult.ok Seq.empty) f xs
|
|
344
|
+
|
|
345
|
+
/// <summary>
|
|
346
|
+
/// Converts a sequence of task results into a single task result
|
|
347
|
+
/// </summary>
|
|
348
|
+
/// <param name="xs">The input sequence</param>
|
|
349
|
+
/// <returns>A task result with all ok elements in an array or an error result with an array of all errors occuring in the sequence</returns>
|
|
350
|
+
/// <remarks>This function is equivalent to <see cref="traverseTaskResultA"/> but auto-applying the 'id' function</remarks>
|
|
351
|
+
let sequenceTaskResultA xs = traverseTaskResultA id xs
|
|
352
|
+
|
|
353
|
+
#endif
|
|
354
|
+
|
|
355
|
+
/// <summary>
|
|
356
|
+
/// Applies a function to each element of a sequence and returns a single option
|
|
357
|
+
/// </summary>
|
|
358
|
+
/// <param name="state">The initial state</param>
|
|
359
|
+
/// <param name="f">The function to apply to each element</param>
|
|
360
|
+
/// <param name="xs">The input sequence</param>
|
|
361
|
+
/// <returns>An option containing Some array of elements or None if any of the function applications return None</returns>
|
|
362
|
+
let inline traverseOptionM'
|
|
363
|
+
(state: seq<'okOutput> option)
|
|
364
|
+
([<InlineIfLambda>] f: 'okInput -> 'okOutput option)
|
|
365
|
+
(xs: SeqNull<'okInput>)
|
|
366
|
+
: 'okOutput[] option =
|
|
367
|
+
if isNull xs then
|
|
368
|
+
nullArg (nameof xs)
|
|
369
|
+
|
|
370
|
+
match state with
|
|
371
|
+
| None -> None
|
|
372
|
+
| Some initialValues ->
|
|
373
|
+
let values = ResizeArray initialValues
|
|
374
|
+
let mutable ok = true
|
|
375
|
+
use enumerator = xs.GetEnumerator()
|
|
376
|
+
|
|
377
|
+
while ok
|
|
378
|
+
&& enumerator.MoveNext() do
|
|
379
|
+
match f enumerator.Current with
|
|
380
|
+
| Some value -> values.Add value
|
|
381
|
+
| None -> ok <- false
|
|
382
|
+
|
|
383
|
+
if ok then Some(values.ToArray()) else None
|
|
384
|
+
|
|
385
|
+
/// <summary>
|
|
386
|
+
/// Applies a function to each element of a sequence and returns a single option
|
|
387
|
+
/// </summary>
|
|
388
|
+
/// <param name="f">The function to apply to each element</param>
|
|
389
|
+
/// <param name="xs">The input sequence</param>
|
|
390
|
+
/// <returns>An option containing Some array of elements or None if any of the function applications return None</returns>
|
|
391
|
+
/// <remarks>This function is equivalent to <see cref="traverseOptionM'"/> but applying an initial state of 'Seq.empty'</remarks>
|
|
392
|
+
let traverseOptionM f xs = traverseOptionM' (Some Seq.empty) f xs
|
|
393
|
+
|
|
394
|
+
/// <summary>
|
|
395
|
+
/// Converts a sequence of options into a single option
|
|
396
|
+
/// </summary>
|
|
397
|
+
/// <param name="xs">The input sequence</param>
|
|
398
|
+
/// <returns>An option containing Some array of elements or None if any of the function applications return None</returns>
|
|
399
|
+
/// <remarks>This function is equivalent to <see cref="traverseOptionM"/> but auto-applying the 'id' function</remarks>
|
|
400
|
+
let sequenceOptionM xs = traverseOptionM id xs
|
|
401
|
+
|
|
402
|
+
/// <summary>
|
|
403
|
+
/// Applies a function to each element of a sequence and returns a single async option
|
|
404
|
+
/// </summary>
|
|
405
|
+
/// <param name="state">The initial state</param>
|
|
406
|
+
/// <param name="f">The function to apply to each element</param>
|
|
407
|
+
/// <param name="xs">The input sequence</param>
|
|
408
|
+
/// <returns>An async option containing Some array of elements or None if any of the function applications return None</returns>
|
|
409
|
+
let inline traverseAsyncOptionM'
|
|
410
|
+
(state: Async<seq<'okOutput> option>)
|
|
411
|
+
([<InlineIfLambda>] f: 'okInput -> Async<'okOutput option>)
|
|
412
|
+
(xs: SeqNull<'okInput>)
|
|
413
|
+
: Async<'okOutput[] option> =
|
|
414
|
+
if isNull xs then
|
|
415
|
+
nullArg (nameof xs)
|
|
416
|
+
|
|
417
|
+
async {
|
|
418
|
+
match! state with
|
|
419
|
+
| None -> return None
|
|
420
|
+
| Some initialValues ->
|
|
421
|
+
let values = ResizeArray initialValues
|
|
422
|
+
let mutable ok = true
|
|
423
|
+
use enumerator = xs.GetEnumerator()
|
|
424
|
+
|
|
425
|
+
while ok
|
|
426
|
+
&& enumerator.MoveNext() do
|
|
427
|
+
match! f enumerator.Current with
|
|
428
|
+
| Some value -> values.Add value
|
|
429
|
+
| None -> ok <- false
|
|
430
|
+
|
|
431
|
+
return if ok then Some(values.ToArray()) else None
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/// <summary>
|
|
435
|
+
/// Applies a function to each element of a sequence and returns a single async option
|
|
436
|
+
/// </summary>
|
|
437
|
+
/// <param name="f">The function to apply to each element</param>
|
|
438
|
+
/// <param name="xs">The input sequence</param>
|
|
439
|
+
/// <returns>An async option containing Some array of elements or None if any of the function applications return None</returns>
|
|
440
|
+
/// <remarks>This function is equivalent to <see cref="traverseAsyncOptionM'"/> but applying an initial state of 'Async { return Some Seq.empty }'</remarks>
|
|
441
|
+
let traverseAsyncOptionM f xs =
|
|
442
|
+
traverseAsyncOptionM' (async { return Some Seq.empty }) f xs
|
|
443
|
+
|
|
444
|
+
/// <summary>
|
|
445
|
+
/// Converts a sequence of async options into a single async option
|
|
446
|
+
/// </summary>
|
|
447
|
+
/// <param name="xs">The input sequence</param>
|
|
448
|
+
/// <returns>An async option containing Some array of elements or None if any of the function applications return None</returns>
|
|
449
|
+
/// <remarks>This function is equivalent to <see cref="traverseAsyncOptionM"/> but auto-applying the 'id' function</remarks>
|
|
450
|
+
let sequenceAsyncOptionM xs = traverseAsyncOptionM id xs
|
|
451
|
+
|
|
452
|
+
#if !FABLE_COMPILER
|
|
453
|
+
|
|
454
|
+
/// <summary>
|
|
455
|
+
/// Applies a function to each element of a sequence and returns a single voption
|
|
456
|
+
/// </summary>
|
|
457
|
+
/// <param name="state">The initial state</param>
|
|
458
|
+
/// <param name="f">The function to apply to each element</param>
|
|
459
|
+
/// <param name="xs">The input sequence</param>
|
|
460
|
+
/// <returns>A voption containing an Array of elements or None if any of the function applications return None</returns>
|
|
461
|
+
let inline traverseVOptionM'
|
|
462
|
+
(state: ValueOption<'okOutput seq>)
|
|
463
|
+
([<InlineIfLambda>] f: 'okInput -> 'okOutput voption)
|
|
464
|
+
(xs: SeqNull<'okInput>)
|
|
465
|
+
: ValueOption<'okOutput[]> =
|
|
466
|
+
if isNull xs then
|
|
467
|
+
nullArg (nameof xs)
|
|
468
|
+
|
|
469
|
+
match state with
|
|
470
|
+
| ValueNone -> ValueNone
|
|
471
|
+
| ValueSome initialValues ->
|
|
472
|
+
let mutable values = ArrayCollector()
|
|
473
|
+
values.AddMany initialValues
|
|
474
|
+
let mutable ok = true
|
|
475
|
+
use enumerator = xs.GetEnumerator()
|
|
476
|
+
|
|
477
|
+
while ok
|
|
478
|
+
&& enumerator.MoveNext() do
|
|
479
|
+
match f enumerator.Current with
|
|
480
|
+
| ValueSome value -> values.Add value
|
|
481
|
+
| ValueNone -> ok <- false
|
|
482
|
+
|
|
483
|
+
if ok then ValueSome(values.Close()) else ValueNone
|
|
484
|
+
|
|
485
|
+
/// <summary>
|
|
486
|
+
/// Applies a function to each element of a sequence and returns a single voption
|
|
487
|
+
/// </summary>
|
|
488
|
+
/// <param name="f">The function to apply to each element</param>
|
|
489
|
+
/// <param name="xs">The input sequence</param>
|
|
490
|
+
/// <returns>A voption containing Some array of elements or None if any of the function applications return None</returns>
|
|
491
|
+
/// <remarks>This function is equivalent to <see cref="traverseVOptionM'"/> but applying an initial state of 'ValueSome Seq.empty'</remarks>
|
|
492
|
+
let traverseVOptionM f xs =
|
|
493
|
+
traverseVOptionM' (ValueSome Seq.empty) f xs
|
|
494
|
+
|
|
495
|
+
/// <summary>
|
|
496
|
+
/// Converts a sequence of voptions into a single voption
|
|
497
|
+
/// </summary>
|
|
498
|
+
/// <param name="xs">The input sequence</param>
|
|
499
|
+
/// <returns>A voption containing Some array of elements or None if any of the function applications return None</returns>
|
|
500
|
+
/// <remarks>This function is equivalent to <see cref="traverseVOptionM"/> but auto-applying the 'id' function</remarks>
|
|
501
|
+
let sequenceVOptionM xs = traverseVOptionM id xs
|
|
502
|
+
|
|
503
|
+
#endif
|