@magnusopera/fscript 0.86.0 → 0.86.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FScript.Language/Ast.js +2 -2
- package/dist/FScript.Language/BuiltinFunctions.js +31 -19
- package/dist/FScript.Language/BuiltinSignatures.js +6 -6
- package/dist/FScript.Language/BuiltinTypes.js +1 -1
- package/dist/FScript.Language/Error.js +2 -2
- package/dist/FScript.Language/Eval.js +11 -11
- package/dist/FScript.Language/Execution.js +6 -6
- package/dist/FScript.Language/ExportSignatures.js +5 -5
- package/dist/FScript.Language/HostInterop.js +8 -8
- package/dist/FScript.Language/IncludeResolver.js +10 -10
- package/dist/FScript.Language/Interactive.js +7 -7
- package/dist/FScript.Language/Lexer.js +9 -9
- package/dist/FScript.Language/Parser.js +10 -10
- package/dist/FScript.Language/Pretty.js +4 -4
- package/dist/FScript.Language/Span.js +2 -2
- package/dist/FScript.Language/TaskFunctions.js +2 -2
- package/dist/FScript.Language/TaskSharingAnalysis.js +17 -17
- package/dist/FScript.Language/Token.js +2 -2
- package/dist/FScript.Language/TypeInfer.js +12 -12
- package/dist/FScript.Language/Types.js +8 -8
- package/dist/FScript.Language/Value.js +2 -2
- package/dist/Library.js +13 -13
- package/dist/fable_modules/fable-library-js.5.24.0/Async.js +363 -0
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/AsyncBuilder.js +70 -10
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/CHANGELOG.md +90 -1
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/CollectionUtil.js +10 -16
- package/dist/fable_modules/fable-library-js.5.24.0/DateOnlyTemporal.js +146 -0
- package/dist/fable_modules/fable-library-js.5.24.0/DateTimeFormat.js +523 -0
- package/dist/fable_modules/fable-library-js.5.24.0/DateTimeOffsetTemporal.js +283 -0
- package/dist/fable_modules/fable-library-js.5.24.0/DateTimeTemporal.js +243 -0
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Decimal.js +100 -11
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Encoding.js +23 -16
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Guid.js +3 -1
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/MailboxProcessor.js +23 -3
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/MutableMap.js +5 -1
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/MutableSet.js +5 -1
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Numeric.js +38 -1
- package/dist/fable_modules/fable-library-js.5.24.0/Stopwatch.js +65 -0
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/String.js +43 -9
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/System.Text.js +9 -9
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Task.js +22 -0
- package/dist/fable_modules/fable-library-js.5.24.0/TimeOnlyTemporal.js +142 -0
- package/dist/fable_modules/fable-library-js.5.24.0/TimeSpanTemporal.js +259 -0
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Util.js +15 -3
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/big.d.ts +1 -0
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/lib/big.js +111 -64
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/package.json +1 -1
- package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/quotation.js +47 -0
- package/dist/fable_modules/project_cracked.json +1 -1
- package/package.json +1 -1
- package/dist/fable_modules/fable-library-js.5.13.0/Async.js +0 -163
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Array.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/BigInt.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/BitConverter.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Boolean.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Char.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Choice.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/ConditionalWeakTable.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Date.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/DateOffset.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/DateOnly.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Directory.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Double.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Environment.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Event.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/FSharp.Collections.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/FSharp.Core.CompilerServices.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/FSharp.Core.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/File.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Global.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Int32.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/List.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Long.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Map.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/MapUtil.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Native.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Observable.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Option.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Path.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/README.md +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Random.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Range.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Reflection.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/RegExp.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Result.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Seq.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Seq2.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Set.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/System.Collections.Generic.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/System.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/TaskBuilder.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/TimeOnly.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/TimeSpan.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Timer.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Types.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Unicode.13.0.0.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Uri.js +0 -0
|
@@ -633,3 +633,50 @@ export function exprFromJSON(json) {
|
|
|
633
633
|
default: return new ExprValue(json, "unknown");
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
|
+
// ===================================================================
|
|
637
|
+
// DerivedPatterns
|
|
638
|
+
// F# defines these on top of Patterns. AndAlso and OrElse recover the
|
|
639
|
+
// shape `&&` and `||` desugar into; SpecificCall matches a call by the
|
|
640
|
+
// identity of a template quotation rather than by compiled name.
|
|
641
|
+
// ===================================================================
|
|
642
|
+
export function isAndAlso(expr) {
|
|
643
|
+
// a && b ==> if a then b else false
|
|
644
|
+
if (expr instanceof ExprIfThenElse
|
|
645
|
+
&& expr.elseExpr instanceof ExprValue
|
|
646
|
+
&& expr.elseExpr.value === false) {
|
|
647
|
+
return [expr.guard, expr.thenExpr];
|
|
648
|
+
}
|
|
649
|
+
return undefined;
|
|
650
|
+
}
|
|
651
|
+
export function isOrElse(expr) {
|
|
652
|
+
// a || b ==> if a then true else b
|
|
653
|
+
if (expr instanceof ExprIfThenElse
|
|
654
|
+
&& expr.thenExpr instanceof ExprValue
|
|
655
|
+
&& expr.thenExpr.value === true) {
|
|
656
|
+
return [expr.guard, expr.elseExpr];
|
|
657
|
+
}
|
|
658
|
+
return undefined;
|
|
659
|
+
}
|
|
660
|
+
/// A template such as <@ (=) @> quotes as nested lambdas around the call, so
|
|
661
|
+
/// the identifying Call node has to be dug out before comparing.
|
|
662
|
+
function templateCall(expr) {
|
|
663
|
+
let current = expr;
|
|
664
|
+
while (current instanceof ExprLambda) {
|
|
665
|
+
current = current.body;
|
|
666
|
+
}
|
|
667
|
+
return current instanceof ExprCall ? current : undefined;
|
|
668
|
+
}
|
|
669
|
+
// Takes both arguments; the partial application FSharp.Core expresses by
|
|
670
|
+
// currying is built by the replacement instead.
|
|
671
|
+
export function isSpecificCall(template, expr) {
|
|
672
|
+
const wanted = templateCall(template);
|
|
673
|
+
if (wanted === undefined || !(expr instanceof ExprCall))
|
|
674
|
+
return undefined;
|
|
675
|
+
if (expr.method !== wanted.method || expr.declaringType !== wanted.declaringType)
|
|
676
|
+
return undefined;
|
|
677
|
+
const instance = (expr.instance instanceof ExprValue && expr.instance.type === "novalue") ? null : expr.instance;
|
|
678
|
+
// The middle slot is F#'s generic-argument list. The runtime models types as
|
|
679
|
+
// names rather than System.Type, so it is always empty here; callers written
|
|
680
|
+
// against Fable match it with a wildcard.
|
|
681
|
+
return [instance, ofArray([]), ofArray(expr.args)];
|
|
682
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"Version":"5.
|
|
1
|
+
{"Version":"5.24.0","FableOptions":{"TypedArrays":true,"ClampByteArrays":false,"Language":["JavaScript"],"Define":["FABLE_COMPILER","FABLE_COMPILER_5","FABLE_COMPILER_JAVASCRIPT"],"DebugMode":false,"OptimizeFSharpAst":false,"Verbosity":["Normal"],"FileExtension":".js","TriggeredByDependency":false,"NoReflection":false,"JsTemporal":false},"ProjectPath":"/home/runner/work/FScript/FScript/src/FScript.JavaScript/FScript.JavaScript.fsproj","SourcePaths":["/home/runner/work/FScript/FScript/src/FScript.Language/Span.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Error.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Token.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Ast.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Types.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Value.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Lexer.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Parser.fs","/home/runner/work/FScript/FScript/src/FScript.Language/IncludeResolver.fs","/home/runner/work/FScript/FScript/src/FScript.Language/BuiltinTypes.fs","/home/runner/work/FScript/FScript/src/FScript.Language/HostInterop.fs","/home/runner/work/FScript/FScript/src/FScript.Language/BuiltinSignatures.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Execution.fs","/home/runner/work/FScript/FScript/src/FScript.Language/BuiltinFunctions.fs","/home/runner/work/FScript/FScript/src/FScript.Language/TypeInfer.fs","/home/runner/work/FScript/FScript/src/FScript.Language/TaskSharingAnalysis.fs","/home/runner/work/FScript/FScript/src/FScript.Language/ExportSignatures.fs","/home/runner/work/FScript/FScript/src/FScript.Language/TaskFunctions.fs","/home/runner/work/FScript/FScript/src/FScript.Language/DebugHooks.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Eval.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Interactive.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Pretty.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Library.fs","/home/runner/work/FScript/FScript/src/FScript.JavaScript/Library.fs"],"FSharpOptions":["--define:FABLE_COMPILER","--define:FABLE_COMPILER_5","--define:FABLE_COMPILER_JAVASCRIPT","--define:TRACE","--define:RELEASE","--define:NETSTANDARD","--define:NETSTANDARD2_1","--define:NETSTANDARD1_0_OR_GREATER","--define:NETSTANDARD1_1_OR_GREATER","--define:NETSTANDARD1_2_OR_GREATER","--define:NETSTANDARD1_3_OR_GREATER","--define:NETSTANDARD1_4_OR_GREATER","--define:NETSTANDARD1_5_OR_GREATER","--define:NETSTANDARD1_6_OR_GREATER","--define:NETSTANDARD2_0_OR_GREATER","--define:NETSTANDARD2_1_OR_GREATER","--define:NULLABLE","--langversion:preview","--nowarn:FS0988","--targetprofile:netstandard","--noframework","--nologo","--simpleresolution","--nocopyfsharpcore","--nowin32manifest","--warn:3","--fullpaths","--flaterrors","--optimize-","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.ValueTuple.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Threading.Thread.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Threading.Tasks.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Threading.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Text.RegularExpressions.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Text.Encoding.Extensions.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Text.Encoding.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Runtime.Numerics.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Runtime.InteropServices.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Runtime.Extensions.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Runtime.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Reflection.Primitives.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Reflection.Extensions.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Reflection.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Numerics.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Net.Requests.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.IO.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Globalization.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Diagnostics.Tracing.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Diagnostics.Tools.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Diagnostics.Debug.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Core.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Console.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.ComponentModel.TypeConverter.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.ComponentModel.Primitives.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.ComponentModel.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Collections.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Collections.Concurrent.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/netstandard.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/mscorlib.dll","-r:/home/runner/.nuget/packages/fsharp.core/10.1.401/lib/netstandard2.1/FSharp.Core.dll","-r:/home/runner/.nuget/packages/fable.core/5.6.0/lib/netstandard2.0/Fable.Core.dll"],"References":["/home/runner/work/FScript/FScript/src/FScript.Language/FScript.Language.fsproj"],"OutDir":["Some","/home/runner/work/FScript/FScript/src/FScript.JavaScript/dist"],"FableLib":null,"FableLibDir":"/home/runner/work/FScript/FScript/src/FScript.JavaScript/dist/fable_modules/fable-library-js.5.24.0","FableModulesDir":"/home/runner/work/FScript/FScript/src/FScript.JavaScript/dist/fable_modules","OutputType":["Library"],"TargetFramework":["Some","netstandard2.1"],"Configuration":"Release","Exclude":[],"Replace":{},"SourceMaps":false,"SourceMapsRoot":null,"TreatWarningsAsErrors":true}
|
package/package.json
CHANGED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { OperationCanceledException, Trampoline } from "./AsyncBuilder.js";
|
|
2
|
-
import { CancellationToken } from "./AsyncBuilder.js";
|
|
3
|
-
import { protectedCont, protectedBind, protectedReturn } from "./AsyncBuilder.js";
|
|
4
|
-
import { Choice_makeChoice1Of2, Choice_makeChoice2Of2 } from "./Choice.js";
|
|
5
|
-
import { TimeoutException_$ctor } from "./System.js";
|
|
6
|
-
import { Exception } from "./Util.js";
|
|
7
|
-
function emptyContinuation(_x) {
|
|
8
|
-
// NOP
|
|
9
|
-
}
|
|
10
|
-
// MakeAsync: body:(AsyncActivation<'T> -> AsyncReturn) -> Async<'T>
|
|
11
|
-
export function makeAsync(body) {
|
|
12
|
-
return body;
|
|
13
|
-
}
|
|
14
|
-
// Invoke: computation: Async<'T> -> ctxt:AsyncActivation<'T> -> AsyncReturn
|
|
15
|
-
export function invoke(computation, ctx) {
|
|
16
|
-
return computation(ctx);
|
|
17
|
-
}
|
|
18
|
-
// CallThenInvoke: ctxt:AsyncActivation<'T> -> result1:'U -> part2:('U -> Async<'T>) -> AsyncReturn
|
|
19
|
-
export function callThenInvoke(ctx, result1, part2) {
|
|
20
|
-
return part2(result1)(ctx);
|
|
21
|
-
}
|
|
22
|
-
// Bind: ctxt:AsyncActivation<'T> -> part1:Async<'U> -> part2:('U -> Async<'T>) -> AsyncReturn
|
|
23
|
-
export function bind(ctx, part1, part2) {
|
|
24
|
-
return protectedBind(part1, part2)(ctx);
|
|
25
|
-
}
|
|
26
|
-
export function createCancellationToken(arg) {
|
|
27
|
-
const token = new CancellationToken(typeof arg === "boolean" ? arg : false);
|
|
28
|
-
if (typeof arg === "number") {
|
|
29
|
-
setTimeout(() => { token.cancel(); }, arg);
|
|
30
|
-
}
|
|
31
|
-
return token;
|
|
32
|
-
}
|
|
33
|
-
export function cancel(token) {
|
|
34
|
-
token.cancel();
|
|
35
|
-
}
|
|
36
|
-
export function cancelAfter(token, ms) {
|
|
37
|
-
setTimeout(() => { token.cancel(); }, ms);
|
|
38
|
-
}
|
|
39
|
-
export function isCancellationRequested(token) {
|
|
40
|
-
return token != null && token.isCancelled;
|
|
41
|
-
}
|
|
42
|
-
export function throwIfCancellationRequested(token) {
|
|
43
|
-
if (token != null && token.isCancelled) {
|
|
44
|
-
throw new Exception("Operation is cancelled");
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
export function startChild(computation, ms) {
|
|
48
|
-
return protectedCont((ctx) => {
|
|
49
|
-
// Share the parent's cancellation token so cancelling the parent
|
|
50
|
-
// cancels the child, like .NET Async.StartChild
|
|
51
|
-
const promise = startAsPromise(computation, ctx.cancelToken);
|
|
52
|
-
let promiseToRun = promise;
|
|
53
|
-
if (ms) {
|
|
54
|
-
// Race the computation against a timeout: whichever settles first wins.
|
|
55
|
-
promiseToRun = new Promise((resolve, reject) => {
|
|
56
|
-
const timeoutId = setTimeout(() => reject(TimeoutException_$ctor()), ms);
|
|
57
|
-
promise.then(value => { clearTimeout(timeoutId); resolve(value); }, error => { clearTimeout(timeoutId); reject(error); });
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
// Prevent an unhandled rejection when the child is cancelled or fails
|
|
61
|
-
// while nobody awaits it (in F# an unobserved child's cancellation or
|
|
62
|
-
// failure is simply not propagated). awaitPromise attaches its own
|
|
63
|
-
// handlers to the same promise, so awaiting still observes the result.
|
|
64
|
-
promiseToRun.catch(emptyContinuation);
|
|
65
|
-
// JS Promises are hot, computation has already started
|
|
66
|
-
// but we delay returning the result
|
|
67
|
-
protectedReturn(awaitPromise(promiseToRun))(ctx);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
export function awaitPromise(p) {
|
|
71
|
-
return fromContinuations((conts) => p.then(conts[0]).catch((err) => (err instanceof OperationCanceledException
|
|
72
|
-
? conts[2] : conts[1])(err)));
|
|
73
|
-
}
|
|
74
|
-
export function awaitEvent(event, cancelAction) {
|
|
75
|
-
return protectedCont((ctx) => {
|
|
76
|
-
let tokenId;
|
|
77
|
-
const handler = ((_sender, arg) => {
|
|
78
|
-
ctx.cancelToken.removeListener(tokenId);
|
|
79
|
-
event.RemoveHandler(handler);
|
|
80
|
-
ctx.onSuccess(arg);
|
|
81
|
-
});
|
|
82
|
-
tokenId = ctx.cancelToken.addListener(() => {
|
|
83
|
-
event.RemoveHandler(handler);
|
|
84
|
-
if (cancelAction != null) {
|
|
85
|
-
cancelAction();
|
|
86
|
-
}
|
|
87
|
-
ctx.onCancel(new OperationCanceledException());
|
|
88
|
-
});
|
|
89
|
-
event.AddHandler(handler);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
export function cancellationToken() {
|
|
93
|
-
return protectedCont((ctx) => ctx.onSuccess(ctx.cancelToken));
|
|
94
|
-
}
|
|
95
|
-
export const defaultCancellationToken = new CancellationToken();
|
|
96
|
-
export function catchAsync(work) {
|
|
97
|
-
return protectedCont((ctx) => {
|
|
98
|
-
work({
|
|
99
|
-
onSuccess: (x) => ctx.onSuccess(Choice_makeChoice1Of2(x)),
|
|
100
|
-
onError: (ex) => ctx.onSuccess(Choice_makeChoice2Of2(ex)),
|
|
101
|
-
onCancel: ctx.onCancel,
|
|
102
|
-
cancelToken: ctx.cancelToken,
|
|
103
|
-
trampoline: ctx.trampoline,
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
export function fromContinuations(f) {
|
|
108
|
-
return protectedCont((ctx) => f([ctx.onSuccess, ctx.onError, ctx.onCancel]));
|
|
109
|
-
}
|
|
110
|
-
export function ignore(computation) {
|
|
111
|
-
return protectedBind(computation, (_x) => protectedReturn(void 0));
|
|
112
|
-
}
|
|
113
|
-
export function parallel(computations) {
|
|
114
|
-
// Children share the parent's cancellation token, like .NET Async.Parallel
|
|
115
|
-
return protectedCont((ctx) => awaitPromise(Promise.all(Array.from(computations, (w) => startAsPromise(w, ctx.cancelToken))))(ctx));
|
|
116
|
-
}
|
|
117
|
-
export function sequential(computations) {
|
|
118
|
-
function _sequential(computations, cancelToken) {
|
|
119
|
-
let pr = Promise.resolve([]);
|
|
120
|
-
for (const c of computations) {
|
|
121
|
-
pr = pr.then(results => startAsPromise(c, cancelToken).then(r => results.concat([r])));
|
|
122
|
-
}
|
|
123
|
-
return pr;
|
|
124
|
-
}
|
|
125
|
-
// Children share the parent's cancellation token, like .NET Async.Sequential
|
|
126
|
-
return protectedCont((ctx) => awaitPromise(_sequential(computations, ctx.cancelToken))(ctx));
|
|
127
|
-
}
|
|
128
|
-
export function sleep(millisecondsDueTime) {
|
|
129
|
-
return protectedCont((ctx) => {
|
|
130
|
-
let tokenId;
|
|
131
|
-
const timeoutId = setTimeout(() => {
|
|
132
|
-
ctx.cancelToken.removeListener(tokenId);
|
|
133
|
-
ctx.onSuccess(void 0);
|
|
134
|
-
}, millisecondsDueTime);
|
|
135
|
-
tokenId = ctx.cancelToken.addListener(() => {
|
|
136
|
-
clearTimeout(timeoutId);
|
|
137
|
-
ctx.onCancel(new OperationCanceledException());
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
export function start(computation, cancellationToken) {
|
|
142
|
-
return startWithContinuations(computation, emptyContinuation, function (err) { throw err; }, emptyContinuation, cancellationToken);
|
|
143
|
-
}
|
|
144
|
-
export function startImmediate(computation, cancellationToken) {
|
|
145
|
-
return start(computation, cancellationToken);
|
|
146
|
-
}
|
|
147
|
-
export function startWithContinuations(computation, continuation, exceptionContinuation, cancellationContinuation, cancelToken) {
|
|
148
|
-
const trampoline = new Trampoline();
|
|
149
|
-
// Mark the computation completed as soon as a terminal continuation is entered
|
|
150
|
-
// so protectedCont lets exceptions from continuation code propagate instead of
|
|
151
|
-
// routing them to onError (see Trampoline.completed).
|
|
152
|
-
const done = (cont) => (x) => { trampoline.completed = true; return cont(x); };
|
|
153
|
-
computation({
|
|
154
|
-
onSuccess: done(continuation ? continuation : emptyContinuation),
|
|
155
|
-
onError: done(exceptionContinuation),
|
|
156
|
-
onCancel: done(cancellationContinuation),
|
|
157
|
-
cancelToken: cancelToken ? cancelToken : defaultCancellationToken,
|
|
158
|
-
trampoline,
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
export function startAsPromise(computation, cancellationToken) {
|
|
162
|
-
return new Promise((resolve, reject) => startWithContinuations(computation, resolve, reject, reject, cancellationToken ? cancellationToken : defaultCancellationToken));
|
|
163
|
-
}
|
|
File without changes
|
|
File without changes
|
/package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/BitConverter.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/DateOffset.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Directory.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Environment.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/FSharp.Core.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Observable.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Reflection.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/TaskBuilder.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/fable_modules/{fable-library-js.5.13.0 → fable-library-js.5.24.0}/Unicode.13.0.0.js
RENAMED
|
File without changes
|
|
File without changes
|