In [ ]:
. ./nbs_header.ps1
. ./core.ps1
In [ ]:
{ pwsh ../apps/builder/build.ps1 } | Invoke-Block
── markdown ──────────────────────────────────────────────────────────────────── │ # DibParser (Polyglot) ── fsharp ────────────────────────────────────────────────────────────────────── #r @"../../../../../../../.nuget/packages/fsharp.control.asyncseq/3.2.1/lib/netstan dard2.1/FSharp.Control.AsyncSeq.dll" #r @"../../../../../../../.nuget/packages/system.reactive/6.0.1-preview.1/lib/net6. 0/System.Reactive.dll" #r @"../../../../../../../.nuget/packages/system.reactive.linq/6.0.1-preview.1/lib/ netstandard2.0/System.Reactive.Linq.dll" #r @"../../../../../../../.nuget/packages/argu/6.2.4/lib/netstandard2.0/Argu.dll" #r @"../../../../../../../.nuget/packages/fparsec/2.0.0-beta2/lib/netstandard2.1/FP arsec.dll" #r @"../../../../../../../.nuget/packages/fparsec/2.0.0-beta2/lib/netstandard2.1/FP arsecCS.dll" ── pwsh ──────────────────────────────────────────────────────────────────────── ls ~/.nuget/packages/argu ── [ 180.44ms - stdout ] ─────────────────────────────────────────────────────── │ 6.2.4 │ 6.2.5 │ ── fsharp ────────────────────────────────────────────────────────────────────── #if !INTERACTIVE open Lib #endif ── fsharp ────────────────────────────────────────────────────────────────────── open Common open FParsec open SpiralFileSystem.Operators ── markdown ──────────────────────────────────────────────────────────────────── │ ## escapeCell (test) ── fsharp ────────────────────────────────────────────────────────────────────── //// test let inline escapeCell input = input |> SpiralSm.split "\n" |> Array.map (function | line when line |> SpiralSm.starts_with "\\#!" || line |> SpiralSm.starts_with "\\#r" -> System.Text.RegularExpressions.Regex.Replace (line, "^\\\\#", "#") | line -> line ) |> SpiralSm.concat "\n" ── fsharp ────────────────────────────────────────────────────────────────────── //// test $"a{nl}\\#!magic{nl}b{nl}" |> escapeCell |> _assertEqual ( $"a{nl}#!magic{nl}b{nl}" ) ── [ 41.30ms - stdout ] ──────────────────────────────────────────────────────── │ "a │ #!magic │ b │ " │ │ ── markdown ──────────────────────────────────────────────────────────────────── │ ## magicMarker ── fsharp ────────────────────────────────────────────────────────────────────── let magicMarker : Parser<string, unit> = pstring "#!" ── fsharp ────────────────────────────────────────────────────────────────────── //// test "#!magic" |> run magicMarker |> _assertEqual ( Success ("#!", (), Position ("", 2, 1, 3)) ) ── [ 25.08ms - stdout ] ──────────────────────────────────────────────────────── │ Success: "#!" │ │ ── fsharp ────────────────────────────────────────────────────────────────────── //// test "##!magic" |> run magicMarker |> _assertEqual ( Failure ( $"Error in Ln: 1 Col: 1{nl}##!magic{nl}^{nl}Expecting: '#!'{nl}", ParserError ( Position ("", 0, 1, 1), null, ErrorMessageList (ExpectedString "#!") ), () ) ) ── [ 28.08ms - stdout ] ──────────────────────────────────────────────────────── │ Failure: │ Error in Ln: 1 Col: 1 │ ##!magic │ ^ │ Expecting: '#!' │ │ │ ── markdown ──────────────────────────────────────────────────────────────────── │ ## magicCommand ── fsharp ────────────────────────────────────────────────────────────────────── let magicCommand = magicMarker >>. manyTill anyChar newline |>> (System.String.Concat >> SpiralSm.trim) ── fsharp ────────────────────────────────────────────────────────────────────── //// test "#!magic a" |> run magicCommand |> _assertEqual ( Success ("magic", (), Position ("", 8, 2, 1)) ) ── [ 14.80ms - stdout ] ──────────────────────────────────────────────────────── │ Success: "magic" │ │ ── fsharp ────────────────────────────────────────────────────────────────────── //// test " #!magic a" |> run magicCommand |> _assertEqual ( Failure ( $"Error in Ln: 1 Col: 1{nl} #!magic{nl}^{nl}Expecting: '#!'{nl}", ParserError ( Position ("", 0, 1, 1), null, ErrorMessageList (ExpectedString "#!") ), () ) ) ── [ 14.75ms - stdout ] ──────────────────────────────────────────────────────── │ Failure: │ Error in Ln: 1 Col: 1 │ #!magic │ ^ │ Expecting: '#!' │ │ │ ── markdown ──────────────────────────────────────────────────────────────────── │ ## content ── fsharp ────────────────────────────────────────────────────────────────────── let content = (newline >>. magicMarker) <|> (eof >>. preturn "") |> attempt |> lookAhead |> manyTill anyChar |>> (System.String.Concat >> SpiralSm.trim) ── fsharp ────────────────────────────────────────────────────────────────────── //// test "#!magic a " |> run content |> _assertEqual ( Success ("#!magic a", (), Position ("", 14, 7, 1)) ) ── [ 12.99ms - stdout ] ──────────────────────────────────────────────────────── │ Success: "#!magic │ │ │ a" │ │ ── markdown ──────────────────────────────────────────────────────────────────── │ ## Output ── fsharp ────────────────────────────────────────────────────────────────────── type Output = | Fs | Md | Spi | Spir ── markdown ──────────────────────────────────────────────────────────────────── │ ## Magic ── fsharp ────────────────────────────────────────────────────────────────────── type Magic = | Fsharp | Markdown | Spiral of Output | Magic of string ── markdown ──────────────────────────────────────────────────────────────────── │ ## kernelOutputs ── fsharp ────────────────────────────────────────────────────────────────────── let inline kernelOutputs magic = match magic with | Fsharp -> [[ Fs ]] | Markdown -> [[ Md ]] | Spiral output -> [[ output ]] | _ -> [[]] ── markdown ──────────────────────────────────────────────────────────────────── │ ## Block ── fsharp ────────────────────────────────────────────────────────────────────── type Block = { magic : Magic content : string } ── markdown ──────────────────────────────────────────────────────────────────── │ ## block ── fsharp ────────────────────────────────────────────────────────────────────── let block = pipe2 magicCommand content (fun magic content -> let magic, content = match magic with | "fsharp" -> Fsharp, content | "markdown" -> Markdown, content | "spiral" -> let output = if content |> SpiralSm.contains "//// real\n" then Spir else Spi let content = if output = Spi then content else content |> SpiralSm.replace "//// real\n\n" "" |> SpiralSm.replace "//// real\n" "" Spiral output, content | magic -> magic |> Magic, content { magic = magic content = content }) ── fsharp ────────────────────────────────────────────────────────────────────── //// test "#!magic a " |> run block |> _assertEqual ( Success ( { magic = Magic "magic"; content = "a" }, (), Position ("", 14, 7, 1) ) ) ── [ 23.95ms - stdout ] ──────────────────────────────────────────────────────── │ Success: { magic = Magic "magic" │ content = "a" } │ │ ── markdown ──────────────────────────────────────────────────────────────────── │ ## blocks ── fsharp ────────────────────────────────────────────────────────────────────── let blocks = skipMany newline >>. sepEndBy block (skipMany1 newline) ── fsharp ────────────────────────────────────────────────────────────────────── //// test "#!magic1 a \#!magic2 b " |> escapeCell |> run blocks |> _assertEqual ( Success ( [[ { magic = Magic "magic1"; content = "a" } { magic = Magic "magic2"; content = "b" } ]], (), Position ("", 26, 9, 1) ) ) ── [ 23.93ms - stdout ] ──────────────────────────────────────────────────────── │ Success: [{ magic = Magic "magic1" │ content = "a" }; { magic = Magic "magic2" │ content = "b" }] │ │ ── markdown ──────────────────────────────────────────────────────────────────── │ ## formatBlock ── fsharp ────────────────────────────────────────────────────────────────────── let inline formatBlock output (block : Block) = match output, block with | output, { magic = Markdown; content = content } -> let markdownComment = match output with | Spi | Spir -> "/// " | Fs -> "/// " | _ -> "" content |> SpiralSm.split "\n" |> Array.map (SpiralSm.trim_end [[||]]) |> Array.filter (SpiralSm.ends_with " (test)" >> not) |> Array.map (function | "" -> markdownComment | line -> System.Text.RegularExpressions.Regex.Replace (line, "^\\s*", $"$&{markdownComment}") ) |> SpiralSm.concat "\n" | Fs, { magic = Fsharp; content = content } -> let trimmedContent = content |> SpiralSm.trim if trimmedContent |> SpiralSm.contains "//// test\n" || trimmedContent |> SpiralSm.contains "//// ignore\n" then "" else content |> SpiralSm.split "\n" |> Array.filter (SpiralSm.trim_start [[||]] >> SpiralSm.starts_with "#r" >> not) |> SpiralSm.concat "\n" | (Spi | Spir), { magic = Spiral output'; content = content } when output' = output -> let trimmedContent = content |> SpiralSm.trim if trimmedContent |> SpiralSm.contains "//// test\n" || trimmedContent |> SpiralSm.contains "//// ignore\n" then "" else content | _ -> "" ── fsharp ────────────────────────────────────────────────────────────────────── //// test "#!markdown a b c \#!markdown c \#!fsharp let a = 1" |> escapeCell |> run block |> function | Success (block, _, _) -> formatBlock Fs block | Failure (msg, _, _) -> failwith msg |> _assertEqual "/// a /// /// b /// /// c" ── [ 31.57ms - stdout ] ──────────────────────────────────────────────────────── │ "/// a │ /// │ /// b │ /// │ /// c" │ │ ── markdown ──────────────────────────────────────────────────────────────────── │ ## formatBlocks ── fsharp ────────────────────────────────────────────────────────────────────── let inline formatBlocks output blocks = blocks |> List.map (fun block -> block, formatBlock output block ) |> List.filter (snd >> (<>) "") |> fun list -> (list, (None, [[]])) ||> List.foldBack (fun (block, content) (lastMagic, acc) -> let lineBreak = if block.magic = Markdown && lastMagic <> Some Markdown && lastMagic <> None then "" else "\n" Some block.magic, $"{content}{lineBreak}" :: acc ) |> snd |> SpiralSm.concat "\n" ── fsharp ────────────────────────────────────────────────────────────────────── //// test "#!markdown a b \#!markdown c \#!fsharp let a = 1 \#!markdown d (test) \#!fsharp //// test let a = 2 \#!markdown e \#!fsharp let a = 3" |> escapeCell |> run blocks |> function | Success (blocks, _, _) -> formatBlocks Fs blocks | Failure (msg, _, _) -> failwith msg |> _assertEqual "/// a /// /// b /// c let a = 1 /// e let a = 3 " ── [ 39.63ms - stdout ] ──────────────────────────────────────────────────────── │ "/// a │ /// │ /// b │ │ /// c │ let a = 1 │ │ /// e │ let a = 3 │ " │ │ ── markdown ──────────────────────────────────────────────────────────────────── │ ## indentBlock ── fsharp ────────────────────────────────────────────────────────────────────── let inline indentBlock (block : Block) = { block with content = block.content |> SpiralSm.split "\n" |> Array.fold (fun (lines, isMultiline) line -> let trimmedLine = line |> SpiralSm.trim if trimmedLine = "" then "" :: lines, isMultiline else let inline singleQuoteLine () = trimmedLine |> Seq.sumBy ((=) '"' >> System.Convert.ToInt32) = 1 && trimmedLine |> SpiralSm.contains @"'""'" |> not && trimmedLine |> SpiralSm.ends_with "{" |> not && trimmedLine |> SpiralSm.ends_with "{|" |> not && trimmedLine |> SpiralSm.starts_with "}" |> not && trimmedLine |> SpiralSm.starts_with "|}" |> not match isMultiline, trimmedLine |> SpiralSm.split_string [[| $"{q}{q}{q}" |]] with | false, [[| _; _ |]] -> $" {line}" :: lines, true | true, [[| _; _ |]] -> line :: lines, false | false, _ when singleQuoteLine () -> $" {line}" :: lines, true | false, _ when line |> SpiralSm.starts_with "#" && block.magic = Fsharp -> line :: lines, false | false, _ -> $" {line}" :: lines, false | true, _ when singleQuoteLine () && line |> SpiralSm.starts_with " " -> $" {line}" :: lines, false | true, _ when singleQuoteLine () -> line :: lines, false | true, _ -> line :: lines, true ) ([[]], false) |> fst |> List.rev |> SpiralSm.concat "\n" } ── markdown ──────────────────────────────────────────────────────────────────── │ ## parse ── fsharp ────────────────────────────────────────────────────────────────────── let inline parse output input = match run blocks input with | Success (blocks, _, _) -> blocks |> List.filter (fun block -> block.magic |> kernelOutputs |> List.contains output || block.magic = Markdown ) |> List.map Some |> fun x -> x @ [[ None ]] |> List.pairwise |> List.choose (function | Some { magic = Markdown } as block, Some { magic = Markdown } -> block | Some { magic = Markdown } as block, Some { magic = magic } when magic |> kernelOutputs |> List.contains output -> block | Some { magic = Markdown } as block, _ when output = Md -> block | Some { magic = Markdown }, _ -> None | Some block, _ -> Some block | _ -> None ) |> List.fold (fun (acc, indent) -> function | { magic = Markdown; content = content } when output = Fs && content |> SpiralSm.starts_with "# " && content |> SpiralSm.ends_with ")" -> let moduleName, namespaceName = System.Text.RegularExpressions.Regex.Match (content, @"# (.*) \((.*)\)$") |> fun m -> m.Groups.[[1]].Value, m.Groups.[[2]].Value let moduleBlock = { magic = Fsharp content = $"#if !INTERACTIVE namespace {namespaceName} #endif module {moduleName} =" } moduleBlock :: acc, (indent + 1) | { magic = magic ; content = content } as block when indent > 0 -> indentBlock block :: acc, indent | block -> block :: acc, indent ) ([[]], 0) |> fst |> List.rev |> Result.Ok | Failure (errorMsg, _, _) -> Result.Error errorMsg ── fsharp ────────────────────────────────────────────────────────────────────── //// test let example1 = $"""#!meta {{"kernelInfo":{{"defaultKernelName":"fsharp","items":[[{{"aliases":[[]],"name": "fsharp"}},{{"aliases":[[]],"name":"fsharp"}}]]}}}} \#!markdown # TestModule (TestNamespace) \#!fsharp \#!import file.dib \#!fsharp \#r "nuget:Expecto" \#!markdown ## ParserLibrary \#!fsharp open System \#!markdown ## x (test) \#!fsharp //// ignore let x = 1 \#!spiral //// test inl x = 1i32 \#!spiral //// real inl x = 2i32 \#!spiral inl x = 3i32 \#!markdown ### TextInput \#!fsharp let str1 = "abc def" let str2 = "abc\ def" let str3 = $"1{{ 1 }}1" let str4 = $"1{{({{| a = 1 |}}).a}}1" let str5 = "abc \ def" let x = match '"' with | '"' -> true | _ -> false let long1 = {q}{q}{q}a{q}{q}{q} let long2 = {q}{q}{q} a {q}{q}{q} \#!fsharp type Position = {{ #if INTERACTIVE line : string #else line : int #endif column : int }}""" |> escapeCell ── fsharp ────────────────────────────────────────────────────────────────────── //// test example1 |> parse Fs |> Result.toOption |> Option.get |> (formatBlocks Fs) |> _assertEqual $"""#if !INTERACTIVE namespace TestNamespace #endif module TestModule = /// ## ParserLibrary open System /// ### TextInput let str1 = "abc def" let str2 = "abc\ def" let str3 = $"1{{ 1 }}1" let str4 = $"1{{({{| a = 1 |}}).a}}1" let str5 = "abc \ def" let x = match '"' with | '"' -> true | _ -> false let long1 = {q}{q}{q}a{q}{q}{q} let long2 = {q}{q}{q} a {q}{q}{q} type Position = {{ #if INTERACTIVE line : string #else line : int #endif column : int }} """ ── [ 84.88ms - stdout ] ──────────────────────────────────────────────────────── │ "#if !INTERACTIVE │ namespace TestNamespace │ #endif │ │ module TestModule = │ │ /// ## ParserLibrary │ open System │ │ /// ### TextInput │ let str1 = "abc │ def" │ │ let str2 = │ "abc\ │ def" │ │ let str3 = │ $"1{ │ 1 │ }1" │ │ let str4 = │ $"1{({| │ a = 1 │ |}).a}1" │ │ let str5 = │ "abc \ │ def" │ │ let x = │ match '"' with │ | '"' -> true │ | _ -> false │ │ let long1 = """a""" │ │ let long2 = │ """ │ a │ """ │ │ type Position = │ { │ #if INTERACTIVE │ line : string │ #else │ line : int │ #endif │ column : int │ } │ " │ │ ── fsharp ────────────────────────────────────────────────────────────────────── //// test example1 |> parse Md |> Result.toOption |> Option.get |> (formatBlocks Md) |> _assertEqual "# TestModule (TestNamespace) ## ParserLibrary ### TextInput " ── [ 77.17ms - stdout ] ──────────────────────────────────────────────────────── │ "# TestModule (TestNamespace) │ │ ## ParserLibrary │ │ ### TextInput │ " │ │ ── fsharp ────────────────────────────────────────────────────────────────────── //// test example1 |> parse Spi |> Result.toOption |> Option.get |> (formatBlocks Spi) |> _assertEqual "/// # TestModule (TestNamespace) /// ## ParserLibrary inl x = 3i32 " ── [ 77.58ms - stdout ] ──────────────────────────────────────────────────────── │ "/// # TestModule (TestNamespace) │ │ /// ## ParserLibrary │ inl x = 3i32 │ " │ │ ── fsharp ────────────────────────────────────────────────────────────────────── //// test example1 |> parse Spir |> Result.toOption |> Option.get |> (formatBlocks Spir) |> _assertEqual "/// # TestModule (TestNamespace) /// ## ParserLibrary inl x = 2i32 " ── [ 119.50ms - stdout ] ─────────────────────────────────────────────────────── │ "/// # TestModule (TestNamespace) │ │ /// ## ParserLibrary │ inl x = 2i32 │ " │ │ ── markdown ──────────────────────────────────────────────────────────────────── │ ## parseDibCode ── fsharp ────────────────────────────────────────────────────────────────────── let inline parseDibCode output file = async { trace Debug (fun () -> "parseDibCode") (fun () -> $"output: {output} / file: {file} / {_locals ()}") let! input = file |> SpiralFileSystem.read_all_text_async match parse output input with | Result.Ok blocks -> return blocks |> formatBlocks output | Result.Error msg -> return failwith msg } ── markdown ──────────────────────────────────────────────────────────────────── │ ## writeDibCode ── fsharp ────────────────────────────────────────────────────────────────────── let inline writeDibCode output path = async { trace Debug (fun () -> "writeDibCode") (fun () -> $"output: {output} / path: {path} / {_locals ()}") let! result = parseDibCode output path let pathDir = path |> System.IO.Path.GetDirectoryName let fileNameWithoutExt = match output, path |> System.IO.Path.GetFileNameWithoutExtension with | Spir, fileNameWithoutExt -> $"{fileNameWithoutExt}_real" | _, fileNameWithoutExt -> fileNameWithoutExt let outputPath = pathDir </> $"{fileNameWithoutExt}.{output |> string |> SpiralSm.to_lower}" do! result |> SpiralFileSystem.write_all_text_async outputPath } ── markdown ──────────────────────────────────────────────────────────────────── │ ## Arguments ── fsharp ────────────────────────────────────────────────────────────────────── [[<RequireQualifiedAccess>]] type Arguments = | [[<Argu.ArguAttributes.MainCommand; Argu.ArguAttributes.Mandatory>]] File of file : string * Output interface Argu.IArgParserTemplate with member s.Usage = match s with | File _ -> nameof File ── fsharp ────────────────────────────────────────────────────────────────────── //// test Argu.ArgumentParser.Create<Arguments>().PrintUsage () ── [ 64.98ms - return value ] ────────────────────────────────────────────────── │ "USAGE: dotnet-repl [--help] <file> <fs|md|spi|spir> │ │ FILE: │ │ <file> <fs|md|spi|spir> │ File │ │ OPTIONS: │ │ --help display this list of options. │ " │ ── markdown ──────────────────────────────────────────────────────────────────── │ ## main ── fsharp ────────────────────────────────────────────────────────────────────── let main args = let argsMap = args |> Runtime.parseArgsMap<Arguments> let files = argsMap.[[nameof Arguments.File]] |> List.map (function | Arguments.File (path, output) -> path, output ) files |> List.map (fun (path, output) -> path |> writeDibCode output) |> Async.Parallel |> Async.Ignore |> Async.runWithTimeout 30000 |> function | Some () -> 0 | None -> 1 ── fsharp ────────────────────────────────────────────────────────────────────── //// test let args = System.Environment.GetEnvironmentVariable "ARGS" |> SpiralRuntime.split_args |> Result.toArray |> Array.collect id match args with | [[||]] -> 0 | args -> if main args = 0 then 0 else failwith "main failed" ── [ 119.30ms - return value ] ───────────────────────────────────────────────── │ <div class="dni-plaintext"><pre>0 │ </pre></div><style> │ .dni-code-hint { │ font-style: italic; │ overflow: hidden; │ white-space: nowrap; │ } │ .dni-treeview { │ white-space: nowrap; │ } │ .dni-treeview td { │ vertical-align: top; │ text-align: start; │ } │ details.dni-treeview { │ padding-left: 1em; │ } │ table td { │ text-align: start; │ } │ table tr { │ vertical-align: top; │ margin: 0em 0px; │ } │ table tr td pre │ { │ vertical-align: top !important; │ margin: 0em 0px !important; │ } │ table th { │ text-align: start; │ } │ </style> ── [ 120.01ms - stdout ] ─────────────────────────────────────────────────────── │ 00:00:02 d #1 writeDibCode / output: Fs / path: Builder.dib │ 00:00:02 d #2 parseDibCode / output: Fs / file: Builder.dib │ 00:00:00 d #1 spiral.main / { args = Array(MutCell(["dib", "--path", "Builder.dib"])) } 00:00:00 d #2 runtime.execute_with_options / { file_name = dotnet; arguments = ["repl", "--exit-after-run", "--run", "/home/runner/work/polyglot/polyglot/apps/builder/Builder.dib", "--output-path", "/home/runner/work/polyglot/polyglot/apps/builder/Builder.dib.ipynb"]; options = { command = dotnet repl --exit-after-run --run "/home/runner/work/polyglot/polyglot/apps/builder/Builder.dib" --output-path "/home/runner/work/polyglot/polyglot/apps/builder/Builder.dib.ipynb"; cancellation_token = None; environment_variables = Array(MutCell([("TRACE_LEVEL", "Verbose"), ("AUTOMATION", "True")])); on_line = None; stdin = None; trace = false; working_directory = None; stderr = true } } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ # Builder (Polyglot) > > ── fsharp ────────────────────────────────────────────────────────────────────── > #r > @"../../../../../../../.nuget/packages/fsharp.control.asyncseq/3.2.1/lib/netstan > dard2.1/FSharp.Control.AsyncSeq.dll" > #r > @"../../../../../../../.nuget/packages/system.reactive/6.0.1-preview.1/lib/net6. > 0/System.Reactive.dll" > #r > @"../../../../../../../.nuget/packages/system.reactive.linq/6.0.1-preview.1/lib/ > netstandard2.0/System.Reactive.Linq.dll" > #r > @"../../../../../../../.nuget/packages/argu/6.2.4/lib/netstandard2.0/Argu.dll" > > ── fsharp ────────────────────────────────────────────────────────────────────── > #if !INTERACTIVE > open Lib > #endif > > ── fsharp ────────────────────────────────────────────────────────────────────── > open Common > open SpiralFileSystem.Operators > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## buildProject > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline buildProject runtime outputDir path = async { > let fullPath = path |> System.IO.Path.GetFullPath > let fileDir = fullPath |> System.IO.Path.GetDirectoryName > let extension = fullPath |> System.IO.Path.GetExtension > > trace Debug > (fun () -> "buildProject") > (fun () -> $"fullPath: {fullPath} / {_locals ()}") > > match extension with > | ".fsproj" -> () > | _ -> failwith "Invalid project file" > > let runtimes = > runtime > |> Option.map List.singleton > |> Option.defaultValue [[ "linux-x64"; "win-x64" ]] > > let outputDir = outputDir |> Option.defaultValue "dist" > > let! exitCodes = > runtimes > |> List.map (fun runtime -> async { > let command = $@"dotnet publish ""{fullPath}"" --configuration > Release --output ""{outputDir}"" --runtime {runtime}" > let! exitCode, _result = > SpiralRuntime.execution_options (fun x -> > { x with > l0 = command > l6 = Some fileDir > } > ) > |> SpiralRuntime.execute_with_options_async > return exitCode > }) > |> Async.Sequential > |> Async.map Array.sum > > if "CI" |> System.Environment.GetEnvironmentVariable |> > System.String.IsNullOrEmpty |> not then > do! fileDir </> "bin" |> SpiralFileSystem.delete_directory_async |> > Async.Ignore > do! fileDir </> "obj" |> SpiralFileSystem.delete_directory_async |> > Async.Ignore > > return exitCodes > } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## persistCodeProject > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline persistCodeProject packages modules name hash code = async { > trace Debug > (fun () -> "persistCodeProject") > (fun () -> $"packages: {packages} / modules: {modules} / name: {name} / > hash: {hash} / code.Length: {code |> String.length} / {_locals ()}") > > let workspaceRoot = SpiralFileSystem.get_workspace_root () > > let targetDir = > let targetDir = workspaceRoot </> "target/Builder" </> name > match hash with > | Some hash -> targetDir </> "packages" </> hash > | None -> targetDir > targetDir |> System.IO.Directory.CreateDirectory |> ignore > > let filePath = targetDir </> $"{name}.fs" |> System.IO.Path.GetFullPath > do! code |> SpiralFileSystem.write_all_text_exists filePath > > let modulesCode = > modules > |> List.map (fun path -> $"""<Compile Include="{workspaceRoot </> path}" > />""") > |> SpiralSm.concat "\n " > > let fsprojPath = targetDir </> $"{name}.fsproj" > let fsprojCode = $"""<Project Sdk="Microsoft.NET.Sdk"> > <PropertyGroup> > <TargetFramework>net9.0</TargetFramework> > <LangVersion>preview</LangVersion> > <RollForward>Major</RollForward> > <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> > <ServerGarbageCollection>true</ServerGarbageCollection> > <ConcurrentGarbageCollection>true</ConcurrentGarbageCollection> > <PublishAot>false</PublishAot> > <PublishTrimmed>false</PublishTrimmed> > <PublishSingleFile>true</PublishSingleFile> > <SelfContained>true</SelfContained> > <Version>0.0.1-alpha.1</Version> > <OutputType>Exe</OutputType> > </PropertyGroup> > > <PropertyGroup Condition="$([[MSBuild]]::IsOSPlatform('FreeBSD'))"> > <DefineConstants>_FREEBSD</DefineConstants> > </PropertyGroup> > > <PropertyGroup Condition="$([[MSBuild]]::IsOSPlatform('Linux'))"> > <DefineConstants>_LINUX</DefineConstants> > </PropertyGroup> > > <PropertyGroup Condition="$([[MSBuild]]::IsOSPlatform('OSX'))"> > <DefineConstants>_OSX</DefineConstants> > </PropertyGroup> > > <PropertyGroup Condition="$([[MSBuild]]::IsOSPlatform('Windows'))"> > <DefineConstants>_WINDOWS</DefineConstants> > </PropertyGroup> > > <ItemGroup> > {modulesCode} > <Compile Include="{filePath}" /> > </ItemGroup> > > <ItemGroup> > <FrameworkReference Include="Microsoft.AspNetCore.App" /> > </ItemGroup> > > <Import Project="{workspaceRoot}/.paket/Paket.Restore.targets" /> > </Project> > """ > do! fsprojCode |> SpiralFileSystem.write_all_text_exists fsprojPath > > let paketReferencesPath = targetDir </> "paket.references" > let paketReferencesCode = > "FSharp.Core" :: packages > |> SpiralSm.concat "\n" > do! paketReferencesCode |> SpiralFileSystem.write_all_text_exists > paketReferencesPath > > return fsprojPath > } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## buildCode > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline buildCode runtime packages modules outputDir name code = async { > let! fsprojPath = code |> persistCodeProject packages modules name None > let! exitCode = fsprojPath |> buildProject runtime outputDir > if exitCode <> 0 then > trace Critical > (fun () -> "buildCode") > (fun () -> $"code: {code |> SpiralSm.ellipsis_end 400} / {_locals > ()}") > return exitCode > } > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > "1 + 1 |> ignore" > |> buildCode None [[]] [[]] None "test1" > |> Async.runWithTimeout 300000 > |> _assertEqual (Some 0) > > ── [ 12.68s - stdout ] ───────────────────────────────────────────────────────── > │ 00:00:01 d #1 persistCodeProject / packages: [] / > modules: [] / name: test1 / hash: / code.Length: 15 > │ 00:00:01 d #2 buildProject / fullPath: > /home/runner/work/polyglot/polyglot/target/Builder/test1/test1.fsproj > │ 00:00:03 d #1 runtime.execute_with_options_async / { > file_name = dotnet; arguments = US5_0 > │ "publish > "/home/runner/work/polyglot/polyglot/target/Builder/test1/test1.fsproj" > --configuration Release --output "dist" --runtime linux-x64"; options = { > command = dotnet publish > "/home/runner/work/polyglot/polyglot/target/Builder/test1/test1.fsproj" > --configuration Release --output "dist" --runtime linux-x64; cancellation_token > = None; environment_variables = [||]; on_line = None; stdin = None; trace = > true; working_directory = Some > "/home/runner/work/polyglot/polyglot/target/Builder/test1"; stderr = true } } > │ 00:00:04 v #2 > Determining projects to restore... > │ 00:00:04 v #3 > Paket version > 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 > │ 00:00:04 v #4 > The last full restore is still up to > date. Nothing left to do. > │ 00:00:04 v #5 > Total time taken: 0 milliseconds > │ 00:00:04 v #6 > Paket version > 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 > │ 00:00:05 v #7 > Restoring > /home/runner/work/polyglot/polyglot/target/Builder/test1/test1.fsproj > │ 00:00:05 v #8 > Starting restore process. > │ 00:00:05 v #9 > Total time taken: 0 milliseconds > │ 00:00:07 v #10 > Restored > /home/runner/work/polyglot/polyglot/target/Builder/test1/test1.fsproj (in 1.55 > sec). > │ 00:00:08 v #11 > > /home/runner/work/polyglot/polyglot/target/Builder/test1/test1.fs(1,16): warning > FS0988: Main module of program is empty: nothing will happen when it is run > [/home/runner/work/polyglot/polyglot/target/Builder/test1/test1.fsproj] > │ 00:00:09 v #12 > test1 -> > /home/runner/work/polyglot/polyglot/target/Builder/test1/bin/Release/net9.0/linu > x-x64/test1.dll > │ 00:00:10 v #13 > test1 -> > /home/runner/work/polyglot/polyglot/target/Builder/test1/dist > │ 00:00:10 d #14 runtime.execute_with_options_async / { > exit_code = 0; output_length = 913; options = { command = dotnet publish > "/home/runner/work/polyglot/polyglot/target/Builder/test1/test1.fsproj" > --configuration Release --output "dist" --runtime linux-x64; cancellation_token > = None; environment_variables = [||]; on_line = None; stdin = None; trace = > true; working_directory = Some > "/home/runner/work/polyglot/polyglot/target/Builder/test1"; stderr = true } } > │ 00:00:10 d #15 runtime.execute_with_options_async / { > file_name = dotnet; arguments = US5_0 > │ "publish > "/home/runner/work/polyglot/polyglot/target/Builder/test1/test1.fsproj" > --configuration Release --output "dist" --runtime win-x64"; options = { command > = dotnet publish > "/home/runner/work/polyglot/polyglot/target/Builder/test1/test1.fsproj" > --configuration Release --output "dist" --runtime win-x64; cancellation_token = > None; environment_variables = [||]; on_line = None; stdin = None; trace = true; > working_directory = Some > "/home/runner/work/polyglot/polyglot/target/Builder/test1"; stderr = true } } > │ 00:00:11 v #16 > Determining projects to restore... > │ 00:00:11 v #17 > Paket version > 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 > │ 00:00:11 v #18 > The last full restore is still up to > date. Nothing left to do. > │ 00:00:11 v #19 > Total time taken: 0 milliseconds > │ 00:00:13 v #20 > Restored > /home/runner/work/polyglot/polyglot/target/Builder/test1/test1.fsproj (in 1.48 > sec). > │ 00:00:15 v #21 > > /home/runner/work/polyglot/polyglot/target/Builder/test1/test1.fs(1,16): warning > FS0988: Main module of program is empty: nothing will happen when it is run > [/home/runner/work/polyglot/polyglot/target/Builder/test1/test1.fsproj] > │ 00:00:15 v #22 > test1 -> > /home/runner/work/polyglot/polyglot/target/Builder/test1/bin/Release/net9.0/win- > x64/test1.dll > │ 00:00:16 v #23 > test1 -> > /home/runner/work/polyglot/polyglot/target/Builder/test1/dist > │ 00:00:16 d #24 runtime.execute_with_options_async / { > exit_code = 0; output_length = 703; options = { command = dotnet publish > "/home/runner/work/polyglot/polyglot/target/Builder/test1/test1.fsproj" > --configuration Release --output "dist" --runtime win-x64; cancellation_token = > None; environment_variables = [||]; on_line = None; stdin = None; trace = true; > working_directory = Some > "/home/runner/work/polyglot/polyglot/target/Builder/test1"; stderr = true } } > │ Some 0 > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > "1 + a |> ignore" > |> buildCode None [[]] [[]] None "test2" > |> Async.runWithTimeout 300000 > |> _assertEqual (Some 2) > > ── [ 7.06s - stdout ] ────────────────────────────────────────────────────────── > │ 00:00:14 d #3 persistCodeProject / packages: [] / > modules: [] / name: test2 / hash: / code.Length: 15 > │ 00:00:14 d #4 buildProject / fullPath: > /home/runner/work/polyglot/polyglot/target/Builder/test2/test2.fsproj > │ 00:00:16 d #25 runtime.execute_with_options_async / { > file_name = dotnet; arguments = US5_0 > │ "publish > "/home/runner/work/polyglot/polyglot/target/Builder/test2/test2.fsproj" > --configuration Release --output "dist" --runtime linux-x64"; options = { > command = dotnet publish > "/home/runner/work/polyglot/polyglot/target/Builder/test2/test2.fsproj" > --configuration Release --output "dist" --runtime linux-x64; cancellation_token > = None; environment_variables = [||]; on_line = None; stdin = None; trace = > true; working_directory = Some > "/home/runner/work/polyglot/polyglot/target/Builder/test2"; stderr = true } } > │ 00:00:16 v #26 > Determining projects to restore... > │ 00:00:17 v #27 > Paket version > 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 > │ 00:00:17 v #28 > The last full restore is still up to > date. Nothing left to do. > │ 00:00:17 v #29 > Total time taken: 0 milliseconds > │ 00:00:17 v #30 > Paket version > 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 > │ 00:00:17 v #31 > Restoring > /home/runner/work/polyglot/polyglot/target/Builder/test2/test2.fsproj > │ 00:00:17 v #32 > Starting restore process. > │ 00:00:17 v #33 > Total time taken: 0 milliseconds > │ 00:00:18 v #34 > Restored > /home/runner/work/polyglot/polyglot/target/Builder/test2/test2.fsproj (in 266 > ms). > │ 00:00:20 v #35 > > /home/runner/work/polyglot/polyglot/target/Builder/test2/test2.fs(1,5): error > FS0039: The value or constructor 'a' is not defined. > [/home/runner/work/polyglot/polyglot/target/Builder/test2/test2.fsproj] > │ 00:00:20 d #36 runtime.execute_with_options_async / { > exit_code = 1; output_length = 704; options = { command = dotnet publish > "/home/runner/work/polyglot/polyglot/target/Builder/test2/test2.fsproj" > --configuration Release --output "dist" --runtime linux-x64; cancellation_token > = None; environment_variables = [||]; on_line = None; stdin = None; trace = > true; working_directory = Some > "/home/runner/work/polyglot/polyglot/target/Builder/test2"; stderr = true } } > │ 00:00:20 d #37 runtime.execute_with_options_async / { > file_name = dotnet; arguments = US5_0 > │ "publish > "/home/runner/work/polyglot/polyglot/target/Builder/test2/test2.fsproj" > --configuration Release --output "dist" --runtime win-x64"; options = { command > = dotnet publish > "/home/runner/work/polyglot/polyglot/target/Builder/test2/test2.fsproj" > --configuration Release --output "dist" --runtime win-x64; cancellation_token = > None; environment_variables = [||]; on_line = None; stdin = None; trace = true; > working_directory = Some > "/home/runner/work/polyglot/polyglot/target/Builder/test2"; stderr = true } } > │ 00:00:20 v #38 > Determining projects to restore... > │ 00:00:20 v #39 > Paket version > 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 > │ 00:00:20 v #40 > The last full restore is still up to > date. Nothing left to do. > │ 00:00:20 v #41 > Total time taken: 0 milliseconds > │ 00:00:21 v #42 > Restored > /home/runner/work/polyglot/polyglot/target/Builder/test2/test2.fsproj (in 254 > ms). > │ 00:00:23 v #43 > > /home/runner/work/polyglot/polyglot/target/Builder/test2/test2.fs(1,5): error > FS0039: The value or constructor 'a' is not defined. > [/home/runner/work/polyglot/polyglot/target/Builder/test2/test2.fsproj] > │ 00:00:23 d #44 runtime.execute_with_options_async / { > exit_code = 1; output_length = 496; options = { command = dotnet publish > "/home/runner/work/polyglot/polyglot/target/Builder/test2/test2.fsproj" > --configuration Release --output "dist" --runtime win-x64; cancellation_token = > None; environment_variables = [||]; on_line = None; stdin = None; trace = true; > working_directory = Some > "/home/runner/work/polyglot/polyglot/target/Builder/test2"; stderr = true } } > │ 00:00:21 c #5 buildCode / code: 1 + a |> ignore > │ Some 2 > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## readFile > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline readFile path = async { > let! code = path |> SpiralFileSystem.read_all_text_async > > let code = System.Text.RegularExpressions.Regex.Replace ( > code, > @"( *)(let\s+main\s+\w+\s*=)", > fun m -> m.Groups.[[1]].Value + "[[<EntryPoint>]]\n" + > m.Groups.[[1]].Value + m.Groups.[[2]].Value > ) > > let codeTrim = code |> SpiralSm.trim_end [[||]] > return > if codeTrim |> SpiralSm.ends_with "\n()" > then codeTrim |> SpiralSm.slice 0 ((codeTrim |> String.length) - 3) > else code > } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## buildFile > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline buildFile runtime packages modules path = async { > let fullPath = path |> System.IO.Path.GetFullPath > let dir = fullPath |> System.IO.Path.GetDirectoryName > let name = fullPath |> System.IO.Path.GetFileNameWithoutExtension > let! code = fullPath |> readFile > return! code |> buildCode runtime packages modules (dir </> "dist" |> Some) > name > } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## persistFile > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline persistFile packages modules path = async { > let fullPath = path |> System.IO.Path.GetFullPath > let name = fullPath |> System.IO.Path.GetFileNameWithoutExtension > let! code = fullPath |> readFile > return! code |> persistCodeProject packages modules name None > } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## Arguments > > ── fsharp ────────────────────────────────────────────────────────────────────── > [[<RequireQualifiedAccess>]] > type Arguments = > | [[<Argu.ArguAttributes.MainCommand; Argu.ArguAttributes.ExactlyOnce>]] > Path of path : string > | [[<Argu.ArguAttributes.Unique>]] Packages of packages : string list > | [[<Argu.ArguAttributes.Unique>]] Modules of modules : string list > | [[<Argu.ArguAttributes.Unique>]] Runtime of runtime : string > | [[<Argu.ArguAttributes.Unique>]] Persist_Only > > interface Argu.IArgParserTemplate with > member s.Usage = > match s with > | Path _ -> nameof Path > | Packages _ -> nameof Packages > | Modules _ -> nameof Modules > | Runtime _ -> nameof Runtime > | Persist_Only -> nameof Persist_Only > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > Argu.ArgumentParser.Create<Arguments>().PrintUsage () > > ── [ 80.56ms - return value ] ────────────────────────────────────────────────── > │ "USAGE: dotnet-repl [--help] [--packages [<packages>...]] > │ [--modules [<modules>...]] [--runtime > <runtime>] > │ [--persist-only] <path> > │ > │ PATH: > │ > │ <path> Path > │ > │ OPTIONS: > │ > │ --packages [<packages>...] > │ Packages > │ --modules [<modules>...] > │ Modules > │ --runtime <runtime> Runtime > │ --persist-only Persist_Only > │ --help display this list of options. > │ " > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## main > > ── fsharp ────────────────────────────────────────────────────────────────────── > let main args = > let argsMap = args |> Runtime.parseArgsMap<Arguments> > > let path = > match argsMap.[[nameof Arguments.Path]] with > | [[ Arguments.Path path ]] -> Some path > | _ -> None > |> Option.get > > let packages = > match argsMap |> Map.tryFind (nameof Arguments.Packages) with > | Some [[ Arguments.Packages packages ]] -> packages > | _ -> [[]] > > let modules = > match argsMap |> Map.tryFind (nameof Arguments.Modules) with > | Some [[ Arguments.Modules modules ]] -> modules > | _ -> [[]] > > let runtime = > match argsMap |> Map.tryFind (nameof Arguments.Runtime) with > | Some [[ Arguments.Runtime runtime ]] -> Some runtime > | _ -> None > > let persistOnly = argsMap |> Map.containsKey (nameof Arguments.Persist_Only) > > if persistOnly > then path |> persistFile packages modules |> Async.map (fun _ -> 0) > else path |> buildFile runtime packages modules > |> Async.runWithTimeout (60001 * 60 * 24) > |> function > | Some exitCode -> exitCode > | None -> 1 > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let args = > System.Environment.GetEnvironmentVariable "ARGS" > |> SpiralRuntime.split_args > |> Result.toArray > |> Array.collect id > > match args with > | [[||]] -> 0 > | args -> if main args = 0 then 0 else failwith "main failed" > > ── [ 14.54s - return value ] ─────────────────────────────────────────────────── > │ <div class="dni-plaintext"><pre>0 > │ </pre></div><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 14.54s - stdout ] ───────────────────────────────────────────────────────── > │ 00:00:21 d #6 persistCodeProject / packages: [Argu; > FSharp.Control.AsyncSeq; System.Reactive.Linq] / modules: > [deps/spiral/lib/spiral/common.fsx; deps/spiral/lib/spiral/sm.fsx; > deps/spiral/lib/spiral/crypto.fsx; ... ] / name: Builder / hash: / code.Length: > 8673 > │ 00:00:21 d #7 buildProject / fullPath: > /home/runner/work/polyglot/polyglot/target/Builder/Builder/Builder.fsproj > │ 00:00:23 d #45 runtime.execute_with_options_async / { > file_name = dotnet; arguments = US5_0 > │ "publish > "/home/runner/work/polyglot/polyglot/target/Builder/Builder/Builder.fsproj" > --configuration Release --output > "/home/runner/work/polyglot/polyglot/apps/builder/dist" --runtime linux-x64"; > options = { command = dotnet publish > "/home/runner/work/polyglot/polyglot/target/Builder/Builder/Builder.fsproj" > --configuration Release --output > "/home/runner/work/polyglot/polyglot/apps/builder/dist" --runtime linux-x64; > cancellation_token = None; environment_variables = [||]; on_line = None; stdin = > None; trace = true; working_directory = Some > "/home/runner/work/polyglot/polyglot/target/Builder/Builder"; stderr = true } } > │ 00:00:24 v #46 > Determining projects to restore... > │ 00:00:24 v #47 > Paket version > 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 > │ 00:00:24 v #48 > The last full restore is still up to > date. Nothing left to do. > │ 00:00:24 v #49 > Total time taken: 0 milliseconds > │ 00:00:25 v #50 > Paket version > 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 > │ 00:00:25 v #51 > Restoring > /home/runner/work/polyglot/polyglot/target/Builder/Builder/Builder.fsproj > │ 00:00:25 v #52 > Starting restore process. > │ 00:00:25 v #53 > Total time taken: 0 milliseconds > │ 00:00:26 v #54 > Restored > /home/runner/work/polyglot/polyglot/target/Builder/Builder/Builder.fsproj (in > 260 ms). > │ 00:00:37 v #55 > Builder -> > /home/runner/work/polyglot/polyglot/target/Builder/Builder/bin/Release/net9.0/li > nux-x64/Builder.dll > │ 00:00:38 v #56 > Builder -> > /home/runner/work/polyglot/polyglot/apps/builder/dist > │ 00:00:38 d #57 runtime.execute_with_options_async / { > exit_code = 0; output_length = 690; options = { command = dotnet publish > "/home/runner/work/polyglot/polyglot/target/Builder/Builder/Builder.fsproj" > --configuration Release --output > "/home/runner/work/polyglot/polyglot/apps/builder/dist" --runtime linux-x64; > cancellation_token = None; environment_variables = [||]; on_line = None; stdin = > None; trace = true; working_directory = Some > "/home/runner/work/polyglot/polyglot/target/Builder/Builder"; stderr = true } } > │ 00:00:51 v #3 runtime.execute_with_options / result / { file_name = dotnet; exit_code = 0; std_trace_length = 27410 } 00:00:51 d #4 runtime.execute_with_options / { file_name = jupyter; arguments = ["nbconvert", "/home/runner/work/polyglot/polyglot/apps/builder/Builder.dib.ipynb", "--to", "html", "--HTMLExporter.theme=dark"]; options = { command = jupyter nbconvert "/home/runner/work/polyglot/polyglot/apps/builder/Builder.dib.ipynb" --to html --HTMLExporter.theme=dark; cancellation_token = None; environment_variables = Array(MutCell([])); on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:00:52 v #5 ! [NbConvertApp] Converting notebook /home/runner/work/polyglot/polyglot/apps/builder/Builder.dib.ipynb to html 00:00:52 v #6 ! /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/nbformat/__init__.py:96: MissingIDFieldWarning: Cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future. 00:00:52 v #7 ! validate(nb) 00:00:52 v #8 ! /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/nbconvert/filters/highlight.py:71: UserWarning: IPython3 lexer unavailable, falling back on Python 3 00:00:52 v #9 ! return _pygments_highlight( 00:00:52 v #10 ! [NbConvertApp] Writing 337251 bytes to /home/runner/work/polyglot/polyglot/apps/builder/Builder.dib.html 00:00:52 v #11 runtime.execute_with_options / result / { file_name = jupyter; exit_code = 0; std_trace_length = 904 } 00:00:52 d #12 spiral.process_dib / dib / jupyter nbconvert / { exit_code = 0; jupyter_result_length = 904 } 00:00:52 d #13 runtime.execute_with_options / { file_name = pwsh; arguments = ["-c", "$counter = 1; $path = '/home/runner/work/polyglot/polyglot/apps/builder/Builder.dib.html'; (Get-Content $path -Raw) -replace '(id=\\\"cell-id=)[a-fA-F0-9]{8}', { $_.Groups[1].Value + $counter++ } | Set-Content $path"]; options = { command = pwsh -c "$counter = 1; $path = '/home/runner/work/polyglot/polyglot/apps/builder/Builder.dib.html'; (Get-Content $path -Raw) -replace '(id=\"cell-id=)[a-fA-F0-9]{8}', { $_.Groups[1].Value + $counter++ } | Set-Content $path"; cancellation_token = None; environment_variables = Array(MutCell([])); on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:00:53 v #14 runtime.execute_with_options / result / { file_name = pwsh; exit_code = 0; std_trace_length = 0 } 00:00:53 d #15 spiral.run / dib / html cell ids / { exit_code = 0; pwsh_replace_html_result_length = 0 } 00:00:53 d #16 spiral.process_dib / dib / { exit_code = 0; result_length = 28373 } polyglot/apps/builder/build.ps1 / $env:CI:'true'
In [ ]:
{ pwsh ../deps/spiral/apps/spiral/build.ps1 -fast 1 -SkipFsx 1 } | Invoke-Block
spiral/apps/spiral/build.ps1 / ScriptDir: /home/runner/work/polyglot/polyglot/deps/spiral/apps/spiral / ResolvedScriptDir: /home/runner/work/polyglot/spiral/apps/spiral 00:00:00 d #1 persistCodeProject / packages: [Fable.Core] / modules: [deps/spiral/lib/spiral/common.fsx; deps/spiral/lib/spiral/sm.fsx; deps/spiral/lib/spiral/crypto.fsx; ... ] / name: spiral / hash: / code.Length: 2075126 spiral/lib/spiral/lib.ps1/GetTargetDir / targetDir: /home/runner/work/polyglot/polyglot/target/Builder/spiral polyglot/scripts/core.ps1/ResolveLink #4 / Path: /home/runner/work/polyglot/polyglot/deps/spiral/deps/polyglot/deps/spiral/lib/spiral/../../deps/polyglot / parent_target: / path_target: /home/runner/work/polyglot/polyglot / parent: /home/runner/work/polyglot/polyglot/deps/spiral/deps/polyglot/deps/spiral/lib/spiral/../../deps / End: polyglot spiral/lib/spiral/lib.ps1/BuildFable / TargetDir: /home/runner/work/polyglot/polyglot/target/Builder/spiral / ProjectName: spiral / Language: rs / Runtime: / root: /home/runner/work/polyglot/polyglot Fable 5.0.0-alpha.9: F# to Rust compiler (status: alpha) Thanks to the contributor! @damonmcminn Stand with Ukraine! https://standwithukraine.com.ua/ Parsing target/Builder/spiral/spiral.fsproj... Project and references (14 source files) parsed in 3128ms Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.JSInterop.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Routing.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Routing.Abstractions.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Mvc.ViewFeatures.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Mvc.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Mvc.Core.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Http.Abstractions.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Components.Forms.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Components.Endpoints.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Components.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Started Fable compilation... Fable compilation finished in 14669ms ./deps/spiral/lib/spiral/common.fsx(2339,0): (2339,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/sm.fsx(561,0): (561,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/async_.fsx(252,0): (252,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/threading.fsx(139,0): (139,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/crypto.fsx(2569,0): (2569,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/date_time.fsx(2553,0): (2553,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/platform.fsx(122,0): (122,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/networking.fsx(5637,0): (5637,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/trace.fsx(2897,0): (2897,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/runtime.fsx(9581,0): (9581,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/file_system.fsx(21240,0): (21240,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! warning: /home/runner/work/polyglot/spiral/apps/wasm/Cargo.toml: the cargo feature `edition2024` has been stabilized in the 1.85 release and is no longer necessary to be listed in the manifest See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature. warning: /home/runner/work/polyglot/spiral/apps/spiral/Cargo.toml: the cargo feature `edition2024` has been stabilized in the 1.85 release and is no longer necessary to be listed in the manifest See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature. Compiling libc v0.2.177 Compiling typenum v1.19.0 Checking memchr v2.7.6 Checking futures-core v0.3.31 Checking futures-sink v0.3.31 Compiling autocfg v1.5.0 Checking futures-channel v0.3.31 Compiling num-traits v0.2.19 Checking slab v0.4.11 Checking pin-utils v0.1.0 Compiling getrandom v0.3.4 Checking futures-io v0.3.31 Checking cfg-if v1.0.4 Checking pin-project-lite v0.2.16 Checking futures-task v0.3.31 Checking futures-util v0.3.31 Checking hybrid-array v0.4.5 Checking num_cpus v1.17.0 Checking aho-corasick v1.1.3 Checking const-oid v0.10.1 Checking block-buffer v0.11.0-rc.5 Checking crypto-common v0.2.0-rc.4 Checking regex-syntax v0.8.8 Checking iana-time-zone v0.1.64 Checking chrono v0.4.42 Checking digest v0.11.0-rc.3 Checking uuid v1.18.1 Checking startup v0.1.1 (/home/runner/work/polyglot/spiral/deps/polyglot/lib/rust/fable/fable_modules/fable-library-rust/vendored/startup) Checking futures-timer v3.0.3 Checking cpufeatures v0.2.17 Checking sha2 v0.11.0-rc.2 Checking regex-automata v0.4.13 Checking inline_colorization v0.1.6 Checking futures-executor v0.3.31 Checking futures v0.3.31 Checking fable_library_rust v0.1.0 (/home/runner/work/polyglot/spiral/deps/polyglot/lib/rust/fable/fable_modules/fable-library-rust) Checking regex v1.12.2 Checking spiral_lib v0.0.1 (/home/runner/work/polyglot/spiral/lib/spiral) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./networking.rs (54 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./crypto.rs (17 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./sm.rs (11 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./file_system.rs (180 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./trace.rs (18 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs (229 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./common.rs (18 fixes) warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1382:17 | 1382 | / break '_method34 1383 | | { 1384 | | let v176: Runtime::US8 = 1385 | | if string("") == (v1.get().clone()) { ... | 1467 | | } ; | |______________________^ | = note: `#[warn(break_with_label_and_loop)]` on by default help: wrap this expression in parentheses | 1383 ~ ({ 1384 | let v176: Runtime::US8 = ... 1466 | } 1467 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1646:17 | 1646 | / break '_method38 1647 | | { 1648 | | let v200: Runtime::US8 = 1649 | | if string("") == (v1.get().clone()) { ... | 1733 | | } ; | |______________________^ | help: wrap this expression in parentheses | 1647 ~ ({ 1648 | let v200: Runtime::US8 = ... 1732 | } 1733 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1801:17 | 1801 | / break '_method42 1802 | | { 1803 | | let v66: Runtime::US8 = 1804 | | if string("") == (v1.get().clone()) { ... | 1855 | | } ; | |______________________^ | help: wrap this expression in parentheses | 1802 ~ ({ 1803 | let v66: Runtime::US8 = ... 1854 | } 1855 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3277:17 | 3277 | / break '_method69 3278 | | { 3279 | | let v224: Runtime::US8 = 3280 | | if string("") == (v1.get().clone()) { ... | 3349 | | } ; | |______________________^ | help: wrap this expression in parentheses | 3278 ~ ({ 3279 | let v224: Runtime::US8 = ... 3348 | } 3349 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3685:17 | 3685 | / break '_method70 3686 | | { 3687 | | let v200: Runtime::US8 = 3688 | | if string("") == (v1.get().clone()) { ... | 3800 | | } ; | |______________________^ | help: wrap this expression in parentheses | 3686 ~ ({ 3687 | let v200: Runtime::US8 = ... 3799 | } 3800 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3828:17 | 3828 | / break '_method75 3829 | | { 3830 | | let v200: Runtime::US8 = 3831 | | if string("") == (v1.get().clone()) { ... | 3914 | | } ; | |______________________^ | help: wrap this expression in parentheses | 3829 ~ ({ 3830 | let v200: Runtime::US8 = ... 3913 | } 3914 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3927:17 | 3927 | / break '_method67 3928 | | { 3929 | | let v5: bool = string("") == (v1.get().clone()); 3930 | | let v224: Runtime::US8 = ... | 4427 | | } ; | |______________________^ | help: wrap this expression in parentheses | 3928 ~ ({ 3929 | let v5: bool = string("") == (v1.get().clone()); ... 4426 | } 4427 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./common.rs:720:17 | 720 | / break '_method8 721 | | { 722 | | let result: LrcPtr<MutCell<Common::US7>> = 723 | | refCell(Common::US7::US7_1); ... | 753 | | } ; | |______________________^ | help: wrap this expression in parentheses | 721 ~ ({ 722 | let result: LrcPtr<MutCell<Common::US7>> = ... 752 | } 753 ~ }) ; | System.Management.Automation.RemoteException warning: `spiral_lib` (lib) generated 8 warnings (run `cargo fix --lib -p spiral_lib` to apply 8 suggestions) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./common.rs (1 fix) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs (7 fixes) warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1383:21 | 1383 | ({ | ^ ... 1467 | }) ; | ^ | = note: `#[warn(unused_parens)]` on by default help: remove these parentheses | 1383 ~ { 1384 | let v176: Runtime::US8 = ... 1466 | } 1467 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1647:21 | 1647 | ({ | ^ ... 1733 | }) ; | ^ | help: remove these parentheses | 1647 ~ { 1648 | let v200: Runtime::US8 = ... 1732 | } 1733 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1802:21 | 1802 | ({ | ^ ... 1855 | }) ; | ^ | help: remove these parentheses | 1802 ~ { 1803 | let v66: Runtime::US8 = ... 1854 | } 1855 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3278:21 | 3278 | ({ | ^ ... 3349 | }) ; | ^ | help: remove these parentheses | 3278 ~ { 3279 | let v224: Runtime::US8 = ... 3348 | } 3349 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3686:21 | 3686 | ({ | ^ ... 3800 | }) ; | ^ | help: remove these parentheses | 3686 ~ { 3687 | let v200: Runtime::US8 = ... 3799 | } 3800 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3829:21 | 3829 | ({ | ^ ... 3914 | }) ; | ^ | help: remove these parentheses | 3829 ~ { 3830 | let v200: Runtime::US8 = ... 3913 | } 3914 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3928:21 | 3928 | ({ | ^ ... 4427 | }) ; | ^ | help: remove these parentheses | 3928 ~ { 3929 | let v5: bool = string("") == (v1.get().clone()); ... 4426 | } 4427 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./common.rs:721:21 | 721 | ({ | ^ ... 753 | }) ; | ^ | help: remove these parentheses | 721 ~ { 722 | let result: LrcPtr<MutCell<Common::US7>> = ... 752 | } 753 ~ } ; | System.Management.Automation.RemoteException warning: `spiral_lib` (lib test) generated 8 warnings (run `cargo fix --lib -p spiral_lib --tests` to apply 8 suggestions) Finished `dev` profile [unoptimized + debuginfo] target(s) in 7.99s spiral/apps/spiral/build.ps1 / path: /home/runner/work/polyglot/polyglot/target/Builder/spiral/target/rs/spiral.rs spiral/apps/spiral/build.ps1 / $projectName: spiral / $env:CI:'true' warning: /home/runner/work/polyglot/spiral/apps/wasm/Cargo.toml: the cargo feature `edition2024` has been stabilized in the 1.85 release and is no longer necessary to be listed in the manifest See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature. warning: /home/runner/work/polyglot/spiral/apps/spiral/Cargo.toml: the cargo feature `edition2024` has been stabilized in the 1.85 release and is no longer necessary to be listed in the manifest See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature. Compiling spiral v0.0.1 (/home/runner/work/polyglot/spiral/apps/spiral) Finished `release` profile [optimized] target(s) in 18.42s
In [ ]:
{ pwsh ../apps/parser/build.ps1 } | Invoke-Block
00:00:00 d #1 spiral.main / { args = Array(MutCell(["dib", "--path", "DibParser.dib"])) } 00:00:00 d #2 runtime.execute_with_options / { file_name = dotnet; arguments = ["repl", "--exit-after-run", "--run", "/home/runner/work/polyglot/polyglot/apps/parser/DibParser.dib", "--output-path", "/home/runner/work/polyglot/polyglot/apps/parser/DibParser.dib.ipynb"]; options = { command = dotnet repl --exit-after-run --run "/home/runner/work/polyglot/polyglot/apps/parser/DibParser.dib" --output-path "/home/runner/work/polyglot/polyglot/apps/parser/DibParser.dib.ipynb"; cancellation_token = None; environment_variables = Array(MutCell([("TRACE_LEVEL", "Verbose"), ("AUTOMATION", "True")])); on_line = None; stdin = None; trace = false; working_directory = None; stderr = true } } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ # DibParser (Polyglot) > > ── fsharp ────────────────────────────────────────────────────────────────────── > #r > @"../../../../../../../.nuget/packages/fsharp.control.asyncseq/3.2.1/lib/netstan > dard2.1/FSharp.Control.AsyncSeq.dll" > #r > @"../../../../../../../.nuget/packages/system.reactive/6.0.1-preview.1/lib/net6. > 0/System.Reactive.dll" > #r > @"../../../../../../../.nuget/packages/system.reactive.linq/6.0.1-preview.1/lib/ > netstandard2.0/System.Reactive.Linq.dll" > #r > @"../../../../../../../.nuget/packages/argu/6.2.4/lib/netstandard2.0/Argu.dll" > #r > @"../../../../../../../.nuget/packages/fparsec/2.0.0-beta2/lib/netstandard2.1/FP > arsec.dll" > #r > @"../../../../../../../.nuget/packages/fparsec/2.0.0-beta2/lib/netstandard2.1/FP > arsecCS.dll" > > ── pwsh ──────────────────────────────────────────────────────────────────────── > ls ~/.nuget/packages/argu > > ── [ 185.79ms - stdout ] ─────────────────────────────────────────────────────── > │ 6.2.4 > │ 6.2.5 > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > #if !INTERACTIVE > open Lib > #endif > > ── fsharp ────────────────────────────────────────────────────────────────────── > open Common > open FParsec > open SpiralFileSystem.Operators > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## escapeCell (test) > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let inline escapeCell input = > input > |> SpiralSm.split "\n" > |> Array.map (function > | line when line |> SpiralSm.starts_with "\\#!" || line |> > SpiralSm.starts_with "\\#r" -> > System.Text.RegularExpressions.Regex.Replace (line, "^\\\\#", "#") > | line -> line > ) > |> SpiralSm.concat "\n" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > $"a{nl}\\#!magic{nl}b{nl}" > |> escapeCell > |> _assertEqual ( > $"a{nl}#!magic{nl}b{nl}" > ) > > ── [ 43.57ms - stdout ] ──────────────────────────────────────────────────────── > │ "a > │ #!magic > │ b > │ " > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## magicMarker > > ── fsharp ────────────────────────────────────────────────────────────────────── > let magicMarker : Parser<string, unit> = pstring "#!" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > "#!magic" > |> run magicMarker > |> _assertEqual ( > Success ("#!", (), Position ("", 2, 1, 3)) > ) > > ── [ 26.97ms - stdout ] ──────────────────────────────────────────────────────── > │ Success: "#!" > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > "##!magic" > |> run magicMarker > |> _assertEqual ( > Failure ( > $"Error in Ln: 1 Col: 1{nl}##!magic{nl}^{nl}Expecting: '#!'{nl}", > ParserError ( > Position ("", 0, 1, 1), > null, > ErrorMessageList (ExpectedString "#!") > ), > () > ) > ) > > ── [ 25.85ms - stdout ] ──────────────────────────────────────────────────────── > │ Failure: > │ Error in Ln: 1 Col: 1 > │ ##!magic > │ ^ > │ Expecting: '#!' > │ > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## magicCommand > > ── fsharp ────────────────────────────────────────────────────────────────────── > let magicCommand = > magicMarker > >>. manyTill anyChar newline > |>> (System.String.Concat >> SpiralSm.trim) > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > "#!magic > > a" > |> run magicCommand > |> _assertEqual ( > Success ("magic", (), Position ("", 8, 2, 1)) > ) > > ── [ 15.89ms - stdout ] ──────────────────────────────────────────────────────── > │ Success: "magic" > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > " #!magic > > a" > |> run magicCommand > |> _assertEqual ( > Failure ( > $"Error in Ln: 1 Col: 1{nl} #!magic{nl}^{nl}Expecting: '#!'{nl}", > ParserError ( > Position ("", 0, 1, 1), > null, > ErrorMessageList (ExpectedString "#!") > ), > () > ) > ) > > ── [ 16.08ms - stdout ] ──────────────────────────────────────────────────────── > │ Failure: > │ Error in Ln: 1 Col: 1 > │ #!magic > │ ^ > │ Expecting: '#!' > │ > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## content > > ── fsharp ────────────────────────────────────────────────────────────────────── > let content = > (newline >>. magicMarker) <|> (eof >>. preturn "") > |> attempt > |> lookAhead > |> manyTill anyChar > |>> (System.String.Concat >> SpiralSm.trim) > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > "#!magic > > > a > > > " > |> run content > |> _assertEqual ( > Success ("#!magic > > > a", (), Position ("", 14, 7, 1)) > ) > > ── [ 15.15ms - stdout ] ──────────────────────────────────────────────────────── > │ Success: "#!magic > │ > │ > │ a" > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## Output > > ── fsharp ────────────────────────────────────────────────────────────────────── > type Output = > | Fs > | Md > | Spi > | Spir > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## Magic > > ── fsharp ────────────────────────────────────────────────────────────────────── > type Magic = > | Fsharp > | Markdown > | Spiral of Output > | Magic of string > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## kernelOutputs > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline kernelOutputs magic = > match magic with > | Fsharp -> [[ Fs ]] > | Markdown -> [[ Md ]] > | Spiral output -> [[ output ]] > | _ -> [[]] > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## Block > > ── fsharp ────────────────────────────────────────────────────────────────────── > type Block = > { > magic : Magic > content : string > } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## block > > ── fsharp ────────────────────────────────────────────────────────────────────── > let block = > pipe2 > magicCommand > content > (fun magic content -> > let magic, content = > match magic with > | "fsharp" -> Fsharp, content > | "markdown" -> Markdown, content > | "spiral" -> > let output = if content |> SpiralSm.contains "//// real\n" > then Spir else Spi > let content = > if output = Spi > then content > else > content > |> SpiralSm.replace "//// real\n\n" "" > |> SpiralSm.replace "//// real\n" "" > Spiral output, content > | magic -> magic |> Magic, content > { > magic = magic > content = content > }) > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > "#!magic > > > a > > > " > |> run block > |> _assertEqual ( > Success ( > { magic = Magic "magic"; content = "a" }, > (), > Position ("", 14, 7, 1) > ) > ) > > ── [ 26.25ms - stdout ] ──────────────────────────────────────────────────────── > │ Success: { magic = Magic "magic" > │ content = "a" } > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## blocks > > ── fsharp ────────────────────────────────────────────────────────────────────── > let blocks = > skipMany newline > >>. sepEndBy block (skipMany1 newline) > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > > "#!magic1 > > a > > \#!magic2 > > b > > " > |> escapeCell > |> run blocks > |> _assertEqual ( > Success ( > [[ > { magic = Magic "magic1"; content = "a" } > { magic = Magic "magic2"; content = "b" } > ]], > (), > Position ("", 26, 9, 1) > ) > ) > > ── [ 26.54ms - stdout ] ──────────────────────────────────────────────────────── > │ Success: [{ magic = Magic "magic1" > │ content = "a" }; { magic = Magic "magic2" > │ content = "b" }] > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## formatBlock > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline formatBlock output (block : Block) = > match output, block with > | output, { magic = Markdown; content = content } -> > let markdownComment = > match output with > | Spi | Spir -> "/// " > | Fs -> "/// " > | _ -> "" > content > |> SpiralSm.split "\n" > |> Array.map (SpiralSm.trim_end [[||]]) > |> Array.filter (SpiralSm.ends_with " (test)" >> not) > |> Array.map (function > | "" -> markdownComment > | line -> System.Text.RegularExpressions.Regex.Replace (line, > "^\\s*", $"$&{markdownComment}") > ) > |> SpiralSm.concat "\n" > | Fs, { magic = Fsharp; content = content } -> > let trimmedContent = content |> SpiralSm.trim > if trimmedContent |> SpiralSm.contains "//// test\n" > || trimmedContent |> SpiralSm.contains "//// ignore\n" > then "" > else > content > |> SpiralSm.split "\n" > |> Array.filter (SpiralSm.trim_start [[||]] >> SpiralSm.starts_with > "#r" >> not) > |> SpiralSm.concat "\n" > | (Spi | Spir), { magic = Spiral output'; content = content } when output' = > output -> > let trimmedContent = content |> SpiralSm.trim > if trimmedContent |> SpiralSm.contains "//// test\n" > || trimmedContent |> SpiralSm.contains "//// ignore\n" > then "" > else content > | _ -> "" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > "#!markdown > > > a > > b > > c > > > \#!markdown > > > c > > > \#!fsharp > > > let a = 1" > |> escapeCell > |> run block > |> function > | Success (block, _, _) -> formatBlock Fs block > | Failure (msg, _, _) -> failwith msg > |> _assertEqual "/// a > /// > /// b > /// > /// c" > > ── [ 36.12ms - stdout ] ──────────────────────────────────────────────────────── > │ "/// a > │ /// > │ /// b > │ /// > │ /// c" > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## formatBlocks > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline formatBlocks output blocks = > blocks > |> List.map (fun block -> > block, formatBlock output block > ) > |> List.filter (snd >> (<>) "") > |> fun list -> > (list, (None, [[]])) > ||> List.foldBack (fun (block, content) (lastMagic, acc) -> > let lineBreak = > if block.magic = Markdown && lastMagic <> Some Markdown && > lastMagic <> None > then "" > else "\n" > Some block.magic, $"{content}{lineBreak}" :: acc > ) > |> snd > |> SpiralSm.concat "\n" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > "#!markdown > > > a > > b > > > \#!markdown > > > c > > > \#!fsharp > > > let a = 1 > > \#!markdown > > d (test) > > \#!fsharp > > //// test > > let a = 2 > > \#!markdown > > e > > \#!fsharp > > let a = 3" > |> escapeCell > |> run blocks > |> function > | Success (blocks, _, _) -> formatBlocks Fs blocks > | Failure (msg, _, _) -> failwith msg > |> _assertEqual "/// a > /// > /// b > > /// c > let a = 1 > > /// e > let a = 3 > " > > ── [ 41.09ms - stdout ] ──────────────────────────────────────────────────────── > │ "/// a > │ /// > │ /// b > │ > │ /// c > │ let a = 1 > │ > │ /// e > │ let a = 3 > │ " > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## indentBlock > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline indentBlock (block : Block) = > { block with > content = > block.content > |> SpiralSm.split "\n" > |> Array.fold > (fun (lines, isMultiline) line -> > let trimmedLine = line |> SpiralSm.trim > if trimmedLine = "" > then "" :: lines, isMultiline > else > let inline singleQuoteLine () = > trimmedLine |> Seq.sumBy ((=) '"' >> > System.Convert.ToInt32) = 1 > && trimmedLine |> SpiralSm.contains @"'""'" |> not > && trimmedLine |> SpiralSm.ends_with "{" |> not > && trimmedLine |> SpiralSm.ends_with "{|" |> not > && trimmedLine |> SpiralSm.starts_with "}" |> not > && trimmedLine |> SpiralSm.starts_with "|}" |> not > > match isMultiline, trimmedLine |> SpiralSm.split_string > [[| $"{q}{q}{q}" |]] with > | false, [[| _; _ |]] -> > $" {line}" :: lines, true > > | true, [[| _; _ |]] -> > line :: lines, false > > | false, _ when singleQuoteLine () -> > $" {line}" :: lines, true > > | false, _ when line |> SpiralSm.starts_with "#" && > block.magic = Fsharp -> > line :: lines, false > > | false, _ -> > $" {line}" :: lines, false > > | true, _ when singleQuoteLine () && line |> > SpiralSm.starts_with " " -> > $" {line}" :: lines, false > > | true, _ when singleQuoteLine () -> > line :: lines, false > > | true, _ -> > line :: lines, true > ) > ([[]], false) > |> fst > |> List.rev > |> SpiralSm.concat "\n" > } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## parse > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline parse output input = > match run blocks input with > | Success (blocks, _, _) -> > blocks > |> List.filter (fun block -> > block.magic |> kernelOutputs |> List.contains output || block.magic > = Markdown > ) > |> List.map Some > |> fun x -> x @ [[ None ]] > |> List.pairwise > |> List.choose (function > | Some { magic = Markdown } as block, Some { magic = Markdown } -> > block > | Some { magic = Markdown } as block, Some { magic = magic } > when magic |> kernelOutputs |> List.contains output -> block > | Some { magic = Markdown } as block, _ when output = Md -> block > | Some { magic = Markdown }, _ -> None > | Some block, _ -> Some block > | _ -> None > ) > |> List.fold > (fun (acc, indent) -> function > | { magic = Markdown; content = content } > when output = Fs > && content |> SpiralSm.starts_with "# " > && content |> SpiralSm.ends_with ")" > -> > let moduleName, namespaceName = > System.Text.RegularExpressions.Regex.Match (content, @"# > (.*) \((.*)\)$") > |> fun m -> m.Groups.[[1]].Value, m.Groups.[[2]].Value > > let moduleBlock = > { > magic = Fsharp > content = > $"#if !INTERACTIVE > namespace {namespaceName} > #endif > > module {moduleName} =" > } > > moduleBlock :: acc, (indent + 1) > | { magic = magic ; content = content } as block > when indent > 0 > -> > indentBlock block :: acc, indent > | block -> block :: acc, indent > ) > ([[]], 0) > |> fst > |> List.rev > |> Result.Ok > | Failure (errorMsg, _, _) -> Result.Error errorMsg > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let example1 = > $"""#!meta > > {{"kernelInfo":{{"defaultKernelName":"fsharp","items":[[{{"aliases":[[]],"name": > "fsharp"}},{{"aliases":[[]],"name":"fsharp"}}]]}}}} > > \#!markdown > > # TestModule (TestNamespace) > > \#!fsharp > > \#!import file.dib > > \#!fsharp > > \#r "nuget:Expecto" > > \#!markdown > > ## ParserLibrary > > \#!fsharp > > open System > > \#!markdown > > ## x (test) > > \#!fsharp > > //// ignore > > let x = 1 > > \#!spiral > > //// test > > inl x = 1i32 > > \#!spiral > > //// real > > inl x = 2i32 > > \#!spiral > > inl x = 3i32 > > \#!markdown > > ### TextInput > > \#!fsharp > > let str1 = "abc > def" > > let str2 = > "abc\ > def" > > let str3 = > $"1{{ > 1 > }}1" > > let str4 = > $"1{{({{| > a = 1 > |}}).a}}1" > > let str5 = > "abc \ > def" > > let x = > match '"' with > | '"' -> true > | _ -> false > > let long1 = {q}{q}{q}a{q}{q}{q} > > let long2 = > {q}{q}{q} > a > {q}{q}{q} > > \#!fsharp > > type Position = > {{ > #if INTERACTIVE > line : string > #else > line : int > #endif > column : int > }}""" > |> escapeCell > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > example1 > |> parse Fs > |> Result.toOption > |> Option.get > |> (formatBlocks Fs) > |> _assertEqual $"""#if !INTERACTIVE > namespace TestNamespace > #endif > > module TestModule = > > /// ## ParserLibrary > open System > > /// ### TextInput > let str1 = "abc > def" > > let str2 = > "abc\ > def" > > let str3 = > $"1{{ > 1 > }}1" > > let str4 = > $"1{{({{| > a = 1 > |}}).a}}1" > > let str5 = > "abc \ > def" > > let x = > match '"' with > | '"' -> true > | _ -> false > > let long1 = {q}{q}{q}a{q}{q}{q} > > let long2 = > {q}{q}{q} > a > {q}{q}{q} > > type Position = > {{ > #if INTERACTIVE > line : string > #else > line : int > #endif > column : int > }} > """ > > ── [ 88.68ms - stdout ] ──────────────────────────────────────────────────────── > │ "#if !INTERACTIVE > │ namespace TestNamespace > │ #endif > │ > │ module TestModule = > │ > │ /// ## ParserLibrary > │ open System > │ > │ /// ### TextInput > │ let str1 = "abc > │ def" > │ > │ let str2 = > │ "abc\ > │ def" > │ > │ let str3 = > │ $"1{ > │ 1 > │ }1" > │ > │ let str4 = > │ $"1{({| > │ a = 1 > │ |}).a}1" > │ > │ let str5 = > │ "abc \ > │ def" > │ > │ let x = > │ match '"' with > │ | '"' -> true > │ | _ -> false > │ > │ let long1 = """a""" > │ > │ let long2 = > │ """ > │ a > │ """ > │ > │ type Position = > │ { > │ #if INTERACTIVE > │ line : string > │ #else > │ line : int > │ #endif > │ column : int > │ } > │ " > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > example1 > |> parse Md > |> Result.toOption > |> Option.get > |> (formatBlocks Md) > |> _assertEqual "# TestModule (TestNamespace) > > ## ParserLibrary > > ### TextInput > " > > ── [ 77.69ms - stdout ] ──────────────────────────────────────────────────────── > │ "# TestModule (TestNamespace) > │ > │ ## ParserLibrary > │ > │ ### TextInput > │ " > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > example1 > |> parse Spi > |> Result.toOption > |> Option.get > |> (formatBlocks Spi) > |> _assertEqual "/// # TestModule (TestNamespace) > > /// ## ParserLibrary > inl x = 3i32 > " > > ── [ 79.09ms - stdout ] ──────────────────────────────────────────────────────── > │ "/// # TestModule (TestNamespace) > │ > │ /// ## ParserLibrary > │ inl x = 3i32 > │ " > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > example1 > |> parse Spir > |> Result.toOption > |> Option.get > |> (formatBlocks Spir) > |> _assertEqual "/// # TestModule (TestNamespace) > > /// ## ParserLibrary > inl x = 2i32 > " > > ── [ 79.29ms - stdout ] ──────────────────────────────────────────────────────── > │ "/// # TestModule (TestNamespace) > │ > │ /// ## ParserLibrary > │ inl x = 2i32 > │ " > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## parseDibCode > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline parseDibCode output file = async { > trace Debug > (fun () -> "parseDibCode") > (fun () -> $"output: {output} / file: {file} / {_locals ()}") > let! input = file |> SpiralFileSystem.read_all_text_async > match parse output input with > | Result.Ok blocks -> return blocks |> formatBlocks output > | Result.Error msg -> return failwith msg > } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## writeDibCode > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline writeDibCode output path = async { > trace Debug > (fun () -> "writeDibCode") > (fun () -> $"output: {output} / path: {path} / {_locals ()}") > let! result = parseDibCode output path > let pathDir = path |> System.IO.Path.GetDirectoryName > let fileNameWithoutExt = > match output, path |> System.IO.Path.GetFileNameWithoutExtension with > | Spir, fileNameWithoutExt -> $"{fileNameWithoutExt}_real" > | _, fileNameWithoutExt -> fileNameWithoutExt > let outputPath = pathDir </> $"{fileNameWithoutExt}.{output |> string |> > SpiralSm.to_lower}" > do! result |> SpiralFileSystem.write_all_text_async outputPath > } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## Arguments > > ── fsharp ────────────────────────────────────────────────────────────────────── > [[<RequireQualifiedAccess>]] > type Arguments = > | [[<Argu.ArguAttributes.MainCommand; Argu.ArguAttributes.Mandatory>]] > File of file : string * Output > > interface Argu.IArgParserTemplate with > member s.Usage = > match s with > | File _ -> nameof File > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > Argu.ArgumentParser.Create<Arguments>().PrintUsage () > > ── [ 66.74ms - return value ] ────────────────────────────────────────────────── > │ "USAGE: dotnet-repl [--help] <file> <fs|md|spi|spir> > │ > │ FILE: > │ > │ <file> <fs|md|spi|spir> > │ File > │ > │ OPTIONS: > │ > │ --help display this list of options. > │ " > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## main > > ── fsharp ────────────────────────────────────────────────────────────────────── > let main args = > let argsMap = args |> Runtime.parseArgsMap<Arguments> > > let files = > argsMap.[[nameof Arguments.File]] > |> List.map (function > | Arguments.File (path, output) -> path, output > ) > > files > |> List.map (fun (path, output) -> path |> writeDibCode output) > |> Async.Parallel > |> Async.Ignore > |> Async.runWithTimeout 30000 > |> function > | Some () -> 0 > | None -> 1 > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let args = > System.Environment.GetEnvironmentVariable "ARGS" > |> SpiralRuntime.split_args > |> Result.toArray > |> Array.collect id > > match args with > | [[||]] -> 0 > | args -> if main args = 0 then 0 else failwith "main failed" > > ── [ 165.24ms - return value ] ───────────────────────────────────────────────── > │ <div class="dni-plaintext"><pre>0 > │ </pre></div><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 165.99ms - stdout ] ─────────────────────────────────────────────────────── > │ 00:00:03 d #1 writeDibCode / output: Fs / path: > DibParser.dib > │ 00:00:03 d #2 parseDibCode / output: Fs / file: > DibParser.dib > │ 00:00:18 v #3 runtime.execute_with_options / result / { file_name = dotnet; exit_code = 0; std_trace_length = 30077 } 00:00:18 d #4 runtime.execute_with_options / { file_name = jupyter; arguments = ["nbconvert", "/home/runner/work/polyglot/polyglot/apps/parser/DibParser.dib.ipynb", "--to", "html", "--HTMLExporter.theme=dark"]; options = { command = jupyter nbconvert "/home/runner/work/polyglot/polyglot/apps/parser/DibParser.dib.ipynb" --to html --HTMLExporter.theme=dark; cancellation_token = None; environment_variables = Array(MutCell([])); on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:00:19 v #5 ! [NbConvertApp] Converting notebook /home/runner/work/polyglot/polyglot/apps/parser/DibParser.dib.ipynb to html 00:00:19 v #6 ! /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/nbformat/__init__.py:96: MissingIDFieldWarning: Cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future. 00:00:19 v #7 ! validate(nb) 00:00:19 v #8 ! /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/nbconvert/filters/highlight.py:71: UserWarning: IPython3 lexer unavailable, falling back on Python 3 00:00:19 v #9 ! return _pygments_highlight( 00:00:20 v #10 ! [NbConvertApp] Writing 381055 bytes to /home/runner/work/polyglot/polyglot/apps/parser/DibParser.dib.html 00:00:20 v #11 runtime.execute_with_options / result / { file_name = jupyter; exit_code = 0; std_trace_length = 906 } 00:00:20 d #12 spiral.process_dib / dib / jupyter nbconvert / { exit_code = 0; jupyter_result_length = 906 } 00:00:20 d #13 runtime.execute_with_options / { file_name = pwsh; arguments = ["-c", "$counter = 1; $path = '/home/runner/work/polyglot/polyglot/apps/parser/DibParser.dib.html'; (Get-Content $path -Raw) -replace '(id=\\\"cell-id=)[a-fA-F0-9]{8}', { $_.Groups[1].Value + $counter++ } | Set-Content $path"]; options = { command = pwsh -c "$counter = 1; $path = '/home/runner/work/polyglot/polyglot/apps/parser/DibParser.dib.html'; (Get-Content $path -Raw) -replace '(id=\"cell-id=)[a-fA-F0-9]{8}', { $_.Groups[1].Value + $counter++ } | Set-Content $path"; cancellation_token = None; environment_variables = Array(MutCell([])); on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:00:20 v #14 runtime.execute_with_options / result / { file_name = pwsh; exit_code = 0; std_trace_length = 0 } 00:00:20 d #15 spiral.run / dib / html cell ids / { exit_code = 0; pwsh_replace_html_result_length = 0 } 00:00:20 d #16 spiral.process_dib / dib / { exit_code = 0; result_length = 31042 } 00:00:00 d #1 persistCodeProject / packages: [Argu; FParsec; FSharp.Control.AsyncSeq; ... ] / modules: [deps/spiral/lib/spiral/common.fsx; deps/spiral/lib/spiral/sm.fsx; deps/spiral/lib/spiral/crypto.fsx; ... ] / name: DibParser / hash: / code.Length: 11045 00:00:00 d #2 buildProject / fullPath: /home/runner/work/polyglot/polyglot/target/Builder/DibParser/DibParser.fsproj 00:00:00 d #1 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 "publish "/home/runner/work/polyglot/polyglot/target/Builder/DibParser/DibParser.fsproj" --configuration Release --output "/home/runner/work/polyglot/polyglot/apps/parser/dist" --runtime linux-x64"; options = { command = dotnet publish "/home/runner/work/polyglot/polyglot/target/Builder/DibParser/DibParser.fsproj" --configuration Release --output "/home/runner/work/polyglot/polyglot/apps/parser/dist" --runtime linux-x64; cancellation_token = None; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot/target/Builder/DibParser"; stderr = true } } 00:00:00 v #2 > Determining projects to restore... 00:00:01 v #3 > Paket version 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 00:00:01 v #4 > The last full restore is still up to date. Nothing left to do. 00:00:01 v #5 > Total time taken: 0 milliseconds 00:00:01 v #6 > Paket version 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 00:00:01 v #7 > Restoring /home/runner/work/polyglot/polyglot/target/Builder/DibParser/DibParser.fsproj 00:00:01 v #8 > Starting restore process. 00:00:01 v #9 > Total time taken: 0 milliseconds 00:00:02 v #10 > Restored /home/runner/work/polyglot/polyglot/target/Builder/DibParser/DibParser.fsproj (in 289 ms). 00:00:14 v #11 > DibParser -> /home/runner/work/polyglot/polyglot/target/Builder/DibParser/bin/Release/net9.0/linux-x64/DibParser.dll 00:00:14 v #12 > DibParser -> /home/runner/work/polyglot/polyglot/apps/parser/dist 00:00:14 d #13 runtime.execute_with_options_async / { exit_code = 0; output_length = 705; options = { command = dotnet publish "/home/runner/work/polyglot/polyglot/target/Builder/DibParser/DibParser.fsproj" --configuration Release --output "/home/runner/work/polyglot/polyglot/apps/parser/dist" --runtime linux-x64; cancellation_token = None; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot/target/Builder/DibParser"; stderr = true } } 00:00:00 d #1 spiral.main / { args = Array(MutCell(["dib", "--path", "JsonParser.dib"])) } 00:00:00 d #2 runtime.execute_with_options / { file_name = dotnet; arguments = ["repl", "--exit-after-run", "--run", "/home/runner/work/polyglot/polyglot/apps/parser/JsonParser.dib", "--output-path", "/home/runner/work/polyglot/polyglot/apps/parser/JsonParser.dib.ipynb"]; options = { command = dotnet repl --exit-after-run --run "/home/runner/work/polyglot/polyglot/apps/parser/JsonParser.dib" --output-path "/home/runner/work/polyglot/polyglot/apps/parser/JsonParser.dib.ipynb"; cancellation_token = None; environment_variables = Array(MutCell([("TRACE_LEVEL", "Verbose"), ("AUTOMATION", "True")])); on_line = None; stdin = None; trace = false; working_directory = None; stderr = true } } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ # JsonParser (Polyglot) > > ── fsharp ────────────────────────────────────────────────────────────────────── > open Common > open Parser > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## JsonParser > > ── fsharp ────────────────────────────────────────────────────────────────────── > (* > // -------------------------------- > JSON spec from http://www.json.org/ > // -------------------------------- > > The JSON spec is available at [[json.org]](http://www.json.org/). I'll paraphase > it here: > > * A `value` can be a `string` or a `number` or a `bool` or `null` or an `object` > or an `array`. > * These structures can be nested. > * A `string` is a sequence of zero or more Unicode characters, wrapped in double > quotes, using backslash escapes. > * A `number` is very much like a C or Java number, except that the octal and > hexadecimal formats are not used. > * A `boolean` is the literal `true` or `false` > * A `null` is the literal `null` > * An `object` is an unordered set of name/value pairs. > * An object begins with { (left brace) and ends with } (right brace). > * Each name is followed by : (colon) and the name/value pairs are separated by > , (comma). > * An `array` is an ordered collection of values. > * An array begins with [[ (left bracket) and ends with ]] (right bracket). > * Values are separated by , (comma). > * Whitespace can be inserted between any pair of tokens. > *) > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let inline parserEqual (expected : ParseResult<'a>) (actual : ParseResult<'a * > Input>) = > match actual, expected with > | Success (_actual, _), Success _expected -> > printResult actual > _actual |> _assertEqual _expected > | Failure (l1, e1, p1), Failure (l2, e2, p2) when l1 = l2 && e1 = e2 && p1 = > p2 -> > printResult actual > | _ -> > printfn $"Actual: {actual}" > printfn $"Expected: {expected}" > failwith "Parse failed" > actual > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### JValue > > ── fsharp ────────────────────────────────────────────────────────────────────── > type JValue = > | JString of string > | JNumber of float > | JBool of bool > | JNull > | JObject of Map<string, JValue> > | JArray of JValue list > > ── fsharp ────────────────────────────────────────────────────────────────────── > let jValue, jValueRef = createParserForwardedToRef<JValue> () > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### jNull > > ── fsharp ────────────────────────────────────────────────────────────────────── > let jNull = > pstring "null" > >>% JNull > <?> "null" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > jValueRef <| > choice > [[ > jNull > ]] > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jValue "null" > |> parserEqual (Success JNull) > > ── [ 158.11ms - return value ] ───────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JNull, { lines = [|"null"|]<br /> > position = { line = 0<br /> column = 4 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JNull, { lines = [|"null"|]<br /> > position = { line = 0<br /> column = 4 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JNull</code></span></summary><div><table><thead><tr> > </tr></thead><tbody></tbody></table></div></details></td></tr><tr><td>Item2</td> > <td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|"null"|]<br /> position = { line = 0<br /> > column = 4 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ null > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 4 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>4 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 168.18ms - stdout ] ─────────────────────────────────────────────────────── > │ JNull > │ JNull > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jNull "nulp" > |> parserEqual ( > Failure ( > "null", > "Unexpected 'p'", > { currentLine = "nulp"; line = 0; column = 3 } > ) > ) > > ── [ 35.71ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Failure ("null", "Unexpected > 'p'", { currentLine = "nulp"<br /> > line = 0<br /> column = 3 > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><div class="dni-plaintext"><pre>"null" > │ </pre></div></td></tr><tr><td>Item2</td><td><div > class="dni-plaintext"><pre>"Unexpected 'p'" > │ </pre></div></td></tr><tr><td>Item3</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ currentLine = > "nulp"<br /> line = 0<br /> column = 3 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>curr > entLine</td><td><div class="dni-plaintext"><pre>"nulp" > │ </pre></div></td></tr><tr><td>line</td><td><div > class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>3 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 36.95ms - stdout ] ──────────────────────────────────────────────────────── > │ Line:0 Col:3 Error parsing null > │ nulp > │ ^Unexpected 'p' > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### jBool > > ── fsharp ────────────────────────────────────────────────────────────────────── > let jBool = > let jtrue = > pstring "true" > >>% JBool true > let jfalse = > pstring "false" > >>% JBool false > > jtrue <|> jfalse > <?> "bool" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > jValueRef <| > choice > [[ > jNull > jBool > ]] > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jBool "true" > |> parserEqual (Success (JBool true)) > > ── [ 31.02ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JBool true, { lines = > [|"true"|]<br /> position = { line = 0<br /> > column = 4 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JBool true, { lines = [|"true"|]<br /> > position = { line = 0<br /> column = 4 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JBool > true</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>I > tem</td><td><div class="dni-plaintext"><pre>true > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|"true"|]<br /> position = { line = 0<br /> > column = 4 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ true > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 4 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>4 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 32.73ms - stdout ] ──────────────────────────────────────────────────────── > │ JBool true > │ JBool true > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jBool "false" > |> parserEqual (Success (JBool false)) > > ── [ 23.19ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JBool false, { lines = > [|"false"|]<br /> position = { line = 0<br /> > column = 5 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JBool false, { lines = [|"false"|]<br /> > position = { line = 0<br /> column = 5 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JBool > false</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td> > Item</td><td><div class="dni-plaintext"><pre>false > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|"false"|]<br /> position = { line = 0<br /> > column = 5 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ false > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 5 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>5 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 24.95ms - stdout ] ──────────────────────────────────────────────────────── > │ JBool false > │ JBool false > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jBool "truX" > |> parserEqual ( > Failure ( > "bool", > "Unexpected 't'", > { currentLine = "truX"; line = 0; column = 0 } > ) > ) > > ── [ 19.38ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Failure ("bool", "Unexpected > 't'", { currentLine = "truX"<br /> > line = 0<br /> column = 0 > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><div class="dni-plaintext"><pre>"bool" > │ </pre></div></td></tr><tr><td>Item2</td><td><div > class="dni-plaintext"><pre>"Unexpected 't'" > │ </pre></div></td></tr><tr><td>Item3</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ currentLine = > "truX"<br /> line = 0<br /> column = 0 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>curr > entLine</td><td><div class="dni-plaintext"><pre>"truX" > │ </pre></div></td></tr><tr><td>line</td><td><div > class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 20.67ms - stdout ] ──────────────────────────────────────────────────────── > │ Line:0 Col:0 Error parsing bool > │ truX > │ ^Unexpected 't' > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### jUnescapedChar > > ── fsharp ────────────────────────────────────────────────────────────────────── > let jUnescapedChar = > satisfy (fun ch -> ch <> '\\' && ch <> '\"') "char" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jUnescapedChar "a" > |> parserEqual (Success 'a') > > ── [ 36.10ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success ('a', { lines = [|"a"|]<br > /> position = { line = 0<br /> column > = 1 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(a, { lines = [|"a"|]<br /> position = { > line = 0<br /> column = 1 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><div class="dni-plaintext"><pre>'a' > │ </pre></div></td></tr><tr><td>Item2</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ lines = > [|"a"|]<br /> position = { line = 0<br /> column = 1 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ a > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 1 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>1 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 37.67ms - stdout ] ──────────────────────────────────────────────────────── > │ 'a' > │ 'a' > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jUnescapedChar "\\" > |> parserEqual ( > Failure ( > "char", > "Unexpected '\\'", > { currentLine = "\\"; line = 0; column = 0 } > ) > ) > > ── [ 25.88ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Failure ("char", "Unexpected > '\'", { currentLine = "\"<br /> > line = 0<br /> column = 0 > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><div class="dni-plaintext"><pre>"char" > │ </pre></div></td></tr><tr><td>Item2</td><td><div > class="dni-plaintext"><pre>"Unexpected '\'" > │ </pre></div></td></tr><tr><td>Item3</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ currentLine = > "\"<br /> line = 0<br /> column = 0 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>curr > entLine</td><td><div class="dni-plaintext"><pre>"\" > │ </pre></div></td></tr><tr><td>line</td><td><div > class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 27.20ms - stdout ] ──────────────────────────────────────────────────────── > │ Line:0 Col:0 Error parsing char > │ \ > │ ^Unexpected '\' > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### jEscapedChar > > ── fsharp ────────────────────────────────────────────────────────────────────── > let jEscapedChar = > [[ > ("\\\"",'\"') > ("\\\\",'\\') > ("\\/",'/') > ("\\b",'\b') > ("\\f",'\f') > ("\\n",'\n') > ("\\r",'\r') > ("\\t",'\t') > ]] > |> List.map (fun (toMatch, result) -> > pstring toMatch >>% result > ) > |> choice > <?> "escaped char" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jEscapedChar "\\\\" > |> parserEqual (Success '\\') > > ── [ 23.02ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success ('\\', { lines = > [|"\\"|]<br /> position = { line = 0<br /> > column = 2 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(\, { lines = [|"\\"|]<br /> position = { > line = 0<br /> column = 2 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><div class="dni-plaintext"><pre>'\\' > │ </pre></div></td></tr><tr><td>Item2</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ lines = > [|"\\"|]<br /> position = { line = 0<br /> column = 2 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ \\ > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 2 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>2 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 25.17ms - stdout ] ──────────────────────────────────────────────────────── > │ '\\' > │ '\\' > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jEscapedChar "\\t" > |> parserEqual (Success '\t') > > ── [ 20.47ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success ('\009', { lines = > [|"\t"|]<br /> position = { line = 0<br /> > column = 2 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>( , { lines = [|"\t"|]<br /> position = { > line = 0<br /> column = 2 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><div class="dni-plaintext"><pre>'\009' > │ </pre></div></td></tr><tr><td>Item2</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ lines = > [|"\t"|]<br /> position = { line = 0<br /> column = 2 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ \t > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 2 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>2 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 22.10ms - stdout ] ──────────────────────────────────────────────────────── > │ '\009' > │ '\009' > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jEscapedChar @"\\" > |> parserEqual (Success '\\') > > ── [ 20.30ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success ('\\', { lines = > [|"\\"|]<br /> position = { line = 0<br /> > column = 2 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(\, { lines = [|"\\"|]<br /> position = { > line = 0<br /> column = 2 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><div class="dni-plaintext"><pre>'\\' > │ </pre></div></td></tr><tr><td>Item2</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ lines = > [|"\\"|]<br /> position = { line = 0<br /> column = 2 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ \\ > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 2 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>2 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 21.86ms - stdout ] ──────────────────────────────────────────────────────── > │ '\\' > │ '\\' > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jEscapedChar @"\n" > |> parserEqual (Success '\n') > > ── [ 20.80ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success ('\010', { lines = [|"<br > />"|]<br /> position = { line = 0<br /> > column = 2 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(<br />, { lines = [|"<br />"|]<br /> > position = { line = 0<br /> column = 2 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><div class="dni-plaintext"><pre>'\010' > │ </pre></div></td></tr><tr><td>Item2</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ lines = > [|"<br />"|]<br /> position = { line = 0<br /> column = > 2 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ <br /> > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 2 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>2 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 22.40ms - stdout ] ──────────────────────────────────────────────────────── > │ '\010' > │ '\010' > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jEscapedChar "a" > |> parserEqual ( > Failure ( > "escaped char", > "Unexpected 'a'", > { currentLine = "a"; line = 0; column = 0 } > ) > ) > > ── [ 19.71ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Failure ("escaped char", "Unexpected > 'a'", { currentLine = "a"<br /> > line = 0<br /> column = 0 > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><div class="dni-plaintext"><pre>"escaped char" > │ </pre></div></td></tr><tr><td>Item2</td><td><div > class="dni-plaintext"><pre>"Unexpected 'a'" > │ </pre></div></td></tr><tr><td>Item3</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ currentLine = > "a"<br /> line = 0<br /> column = 0 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>curr > entLine</td><td><div class="dni-plaintext"><pre>"a" > │ </pre></div></td></tr><tr><td>line</td><td><div > class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 20.99ms - stdout ] ──────────────────────────────────────────────────────── > │ Line:0 Col:0 Error parsing escaped char > │ a > │ ^Unexpected 'a' > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### jUnicodeChar > > ── fsharp ────────────────────────────────────────────────────────────────────── > let jUnicodeChar = > let backslash = pchar '\\' > let uChar = pchar 'u' > let hexdigit = anyOf ([[ '0' .. '9' ]] @ [[ 'A' .. 'F' ]] @ [[ 'a' .. 'f' > ]]) > let fourHexDigits = hexdigit .>>. hexdigit .>>. hexdigit .>>. hexdigit > > let inline convertToChar (((h1, h2), h3), h4) = > let str = $"%c{h1}%c{h2}%c{h3}%c{h4}" > Int32.Parse (str, Globalization.NumberStyles.HexNumber) |> char > > backslash >>. uChar >>. fourHexDigits > |>> convertToChar > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jUnicodeChar "\\u263A" > |> parserEqual (Success '☺') > > ── [ 29.50ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success ('☺', { lines = > [|"\u263A"|]<br /> position = { line = 0<br /> > column = 6 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(☺, { lines = [|"\u263A"|]<br /> position > = { line = 0<br /> column = 6 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><div class="dni-plaintext"><pre>'☺' > │ </pre></div></td></tr><tr><td>Item2</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ lines = > [|"\u263A"|]<br /> position = { line = 0<br /> column = > 6 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ \u263A > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 6 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>6 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 31.06ms - stdout ] ──────────────────────────────────────────────────────── > │ '☺' > │ '☺' > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### jString > > ── fsharp ────────────────────────────────────────────────────────────────────── > let quotedString = > let quote = pchar '\"' <?> "quote" > let jchar = jUnescapedChar <|> jEscapedChar <|> jUnicodeChar > > quote >>. manyChars jchar .>> quote > > ── fsharp ────────────────────────────────────────────────────────────────────── > let jString = > quotedString > |>> JString > <?> "quoted string" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > jValueRef <| > choice > [[ > jNull > jBool > jString > ]] > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jString "\"\"" > |> parserEqual (Success (JString "")) > > ── [ 29.69ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JString "", { lines = > [|""""|]<br /> position = { line = > 0<br /> column = 2 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JString "", { lines = > [|""""|]<br /> position = { line = 0<br /> > column = 2 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JString > ""</code></span></summary><div><table><thead><tr></tr></thead><tbody>< > tr><td>Item</td><td><div class="dni-plaintext"><pre>"" > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|""""|]<br /> position = { line = 0<br /> > column = 2 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ "" > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 2 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>2 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 31.45ms - stdout ] ──────────────────────────────────────────────────────── > │ JString "" > │ JString "" > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jString "\"a\"" > |> parserEqual (Success (JString "a")) > > ── [ 22.26ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JString "a", { lines = > [|""a""|]<br /> position = { line = > 0<br /> column = 3 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JString "a", { lines = > [|""a""|]<br /> position = { line = 0<br /> > column = 3 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JString > "a"</code></span></summary><div><table><thead><tr></tr></thead><tbody> > <tr><td>Item</td><td><div class="dni-plaintext"><pre>"a" > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|""a""|]<br /> position = { line = 0<br /> > column = 3 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ "a" > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 3 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>3 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 23.97ms - stdout ] ──────────────────────────────────────────────────────── > │ JString "a" > │ JString "a" > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jString "\"ab\"" > |> parserEqual (Success (JString "ab")) > > ── [ 22.32ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JString "ab", { lines = > [|""ab""|]<br /> position = { line = > 0<br /> column = 4 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JString "ab", { lines = > [|""ab""|]<br /> position = { line = 0<br /> > column = 4 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JString > "ab"</code></span></summary><div><table><thead><tr></tr></thead><tbody > ><tr><td>Item</td><td><div class="dni-plaintext"><pre>"ab" > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|""ab""|]<br /> position = { line = 0<br /> > column = 4 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ "ab" > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 4 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>4 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 24.09ms - stdout ] ──────────────────────────────────────────────────────── > │ JString "ab" > │ JString "ab" > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jString "\"ab\\tde\"" > |> parserEqual (Success (JString "ab\tde")) > > ── [ 23.78ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JString "ab de", { lines = > [|""ab\tde""|]<br /> position = { > line = 0<br /> column = 8 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JString "ab de", { lines = > [|""ab\tde""|]<br /> position = { line = 0<br /> > column = 8 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JString "ab > de"</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr>< > td>Item</td><td><div class="dni-plaintext"><pre>"ab de" > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|""ab\tde""|]<br /> position = { line = 0<br /> > column = 8 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ "ab\tde" > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 8 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>8 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 25.55ms - stdout ] ──────────────────────────────────────────────────────── > │ JString "ab de" > │ JString "ab de" > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jString "\"ab\\u263Ade\"" > |> parserEqual (Success (JString "ab☺de")) > > ── [ 24.53ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JString "ab☺de", { lines = > [|""ab\u263Ade""|]<br /> position > = { line = 0<br /> column = 12 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JString "ab☺de", { lines = > [|""ab\u263Ade""|]<br /> position = { line = 0<br /> > column = 12 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JString > "ab☺de"</code></span></summary><div><table><thead><tr></tr></thead><tb > ody><tr><td>Item</td><td><div class="dni-plaintext"><pre>"ab☺de" > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|""ab\u263Ade""|]<br /> position = { line = 0<br > /> column = 12 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ "ab\u263Ade" > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 12 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>12 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 26.32ms - stdout ] ──────────────────────────────────────────────────────── > │ JString "ab☺de" > │ JString "ab☺de" > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### jNumber > > ── fsharp ────────────────────────────────────────────────────────────────────── > let jNumber = > let optSign = opt (pchar '-') > > let zero = pstring "0" > > let digitOneNine = > satisfy (fun ch -> Char.IsDigit ch && ch <> '0') "1-9" > > let digit = > satisfy Char.IsDigit "digit" > > let point = pchar '.' > > let e = pchar 'e' <|> pchar 'E' > > let optPlusMinus = opt (pchar '-' <|> pchar '+') > > let nonZeroInt = > digitOneNine .>>. manyChars digit > |>> fun (first, rest) -> string first + rest > > let intPart = zero <|> nonZeroInt > > let fractionPart = point >>. manyChars1 digit > > let exponentPart = e >>. optPlusMinus .>>. manyChars1 digit > > let inline (|>?) opt f = > match opt with > | None -> "" > | Some x -> f x > > let inline convertToJNumber (((optSign, intPart), fractionPart), expPart) = > let signStr = > optSign > |>? string > > let fractionPartStr = > fractionPart > |>? (fun digits -> "." + digits) > > let expPartStr = > expPart > |>? fun (optSign, digits) -> > let sign = optSign |>? string > "e" + sign + digits > > (signStr + intPart + fractionPartStr + expPartStr) > |> float > |> JNumber > > optSign .>>. intPart .>>. opt fractionPart .>>. opt exponentPart > |>> convertToJNumber > <?> "number" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > jValueRef <| > choice > [[ > jNull > jBool > jString > jNumber > ]] > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jNumber "123" > |> parserEqual (Success (JNumber 123.0)) > > ── [ 40.14ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JNumber 123.0, { lines = > [|"123"|]<br /> position = { line = 0<br /> > column = 3 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JNumber 123.0, { lines = [|"123"|]<br /> > position = { line = 0<br /> column = 3 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JNumber > 123.0</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td> > Item</td><td><div class="dni-plaintext"><pre>123.0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|"123"|]<br /> position = { line = 0<br /> > column = 3 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ 123 > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 3 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>3 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 41.85ms - stdout ] ──────────────────────────────────────────────────────── > │ JNumber 123.0 > │ JNumber 123.0 > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jNumber "-123" > |> parserEqual (Success (JNumber -123.0)) > > ── [ 23.05ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JNumber -123.0, { lines = > [|"-123"|]<br /> position = { line = 0<br /> > column = 4 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JNumber -123.0, { lines = [|"-123"|]<br > /> position = { line = 0<br /> column = 4 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JNumber > -123.0</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td > >Item</td><td><div class="dni-plaintext"><pre>-123.0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|"-123"|]<br /> position = { line = 0<br /> > column = 4 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ -123 > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 4 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>4 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 24.74ms - stdout ] ──────────────────────────────────────────────────────── > │ JNumber -123.0 > │ JNumber -123.0 > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jNumber "123.4" > |> parserEqual (Success (JNumber 123.4)) > > ── [ 23.90ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JNumber 123.4, { lines = > [|"123.4"|]<br /> position = { line = 0<br /> > column = 5 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JNumber 123.4, { lines = [|"123.4"|]<br > /> position = { line = 0<br /> column = 5 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JNumber > 123.4</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td> > Item</td><td><div class="dni-plaintext"><pre>123.4 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|"123.4"|]<br /> position = { line = 0<br /> > column = 5 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ 123.4 > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 5 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>5 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 25.55ms - stdout ] ──────────────────────────────────────────────────────── > │ JNumber 123.4 > │ JNumber 123.4 > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jNumber "-123." > |> parserEqual (Success (JNumber -123.0)) > > ── [ 21.84ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JNumber -123.0, { lines = > [|"-123."|]<br /> position = { line = 0<br > /> column = 4 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JNumber -123.0, { lines = [|"-123."|]<br > /> position = { line = 0<br /> column = 4 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JNumber > -123.0</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td > >Item</td><td><div class="dni-plaintext"><pre>-123.0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|"-123."|]<br /> position = { line = 0<br /> > column = 4 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ -123. > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 4 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>4 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 23.47ms - stdout ] ──────────────────────────────────────────────────────── > │ JNumber -123.0 > │ JNumber -123.0 > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jNumber "00.1" > |> parserEqual (Success (JNumber 0.0)) > > ── [ 22.30ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JNumber 0.0, { lines = > [|"00.1"|]<br /> position = { line = 0<br /> > column = 1 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JNumber 0.0, { lines = [|"00.1"|]<br /> > position = { line = 0<br /> column = 1 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JNumber > 0.0</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>It > em</td><td><div class="dni-plaintext"><pre>0.0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|"00.1"|]<br /> position = { line = 0<br /> > column = 1 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ 00.1 > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 0<br /> > column = 1 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>1 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 23.98ms - stdout ] ──────────────────────────────────────────────────────── > │ JNumber 0.0 > │ JNumber 0.0 > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let jNumber_ = jNumber .>> spaces1 > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jNumber_ "123" > |> parserEqual (Success (JNumber 123.0)) > > ── [ 24.21ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JNumber 123.0, { lines = > [|"123"|]<br /> position = { line = 1<br /> > column = 0 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JNumber 123.0, { lines = [|"123"|]<br /> > position = { line = 1<br /> column = 0 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JNumber > 123.0</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td> > Item</td><td><div class="dni-plaintext"><pre>123.0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|"123"|]<br /> position = { line = 1<br /> > column = 0 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ 123 > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 1<br /> > column = 0 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>1 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 26.13ms - stdout ] ──────────────────────────────────────────────────────── > │ JNumber 123.0 > │ JNumber 123.0 > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jNumber_ "-123" > |> parserEqual (Success (JNumber -123.0)) > > ── [ 25.10ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JNumber -123.0, { lines = > [|"-123"|]<br /> position = { line = 1<br /> > column = 0 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JNumber -123.0, { lines = [|"-123"|]<br > /> position = { line = 1<br /> column = 0 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JNumber > -123.0</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td > >Item</td><td><div class="dni-plaintext"><pre>-123.0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|"-123"|]<br /> position = { line = 1<br /> > column = 0 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ -123 > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 1<br /> > column = 0 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>1 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 27.12ms - stdout ] ──────────────────────────────────────────────────────── > │ JNumber -123.0 > │ JNumber -123.0 > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jNumber_ "-123." > |> parserEqual ( > Failure ( > "number andThen many1 whitespace", > "Unexpected '.'", > { currentLine = "-123."; line = 0; column = 4 } > ) > ) > > ── [ 21.30ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Failure<br /> ("number andThen many1 > whitespace", "Unexpected '.'", { currentLine = > "-123."<br /> > line = 0<br /> column = > 4 > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><div class="dni-plaintext"><pre>"number andThen many1 > whitespace" > │ </pre></div></td></tr><tr><td>Item2</td><td><div > class="dni-plaintext"><pre>"Unexpected '.'" > │ </pre></div></td></tr><tr><td>Item3</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ currentLine = > "-123."<br /> line = 0<br /> column = 4 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>curr > entLine</td><td><div class="dni-plaintext"><pre>"-123." > │ </pre></div></td></tr><tr><td>line</td><td><div > class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>4 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 22.86ms - stdout ] ──────────────────────────────────────────────────────── > │ Line:0 Col:4 Error parsing number andThen many1 whitespace > │ -123. > │ ^Unexpected '.' > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jNumber_ "123.4" > |> parserEqual (Success (JNumber 123.4)) > > ── [ 31.04ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JNumber 123.4, { lines = > [|"123.4"|]<br /> position = { line = 1<br /> > column = 0 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JNumber 123.4, { lines = [|"123.4"|]<br > /> position = { line = 1<br /> column = 0 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JNumber > 123.4</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td> > Item</td><td><div class="dni-plaintext"><pre>123.4 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|"123.4"|]<br /> position = { line = 1<br /> > column = 0 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ 123.4 > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 1<br /> > column = 0 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>1 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 33.54ms - stdout ] ──────────────────────────────────────────────────────── > │ JNumber 123.4 > │ JNumber 123.4 > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jNumber_ "00.4" > |> parserEqual ( > Failure ( > "number andThen many1 whitespace", > "Unexpected '0'", > { currentLine = "00.4"; line = 0; column = 1 } > ) > ) > > ── [ 29.83ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Failure<br /> ("number andThen many1 > whitespace", "Unexpected '0'", { currentLine = > "00.4"<br /> > line = 0<br /> column = > 1 > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><div class="dni-plaintext"><pre>"number andThen many1 > whitespace" > │ </pre></div></td></tr><tr><td>Item2</td><td><div > class="dni-plaintext"><pre>"Unexpected '0'" > │ </pre></div></td></tr><tr><td>Item3</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ currentLine = > "00.4"<br /> line = 0<br /> column = 1 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>curr > entLine</td><td><div class="dni-plaintext"><pre>"00.4" > │ </pre></div></td></tr><tr><td>line</td><td><div > class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>1 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 31.14ms - stdout ] ──────────────────────────────────────────────────────── > │ Line:0 Col:1 Error parsing number andThen many1 whitespace > │ 00.4 > │ ^Unexpected '0' > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jNumber_ "123e4" > |> parserEqual (Success (JNumber 1230000.0)) > > ── [ 27.69ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JNumber 1230000.0, { lines = > [|"123e4"|]<br /> position = { line = > 1<br /> column = 0 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JNumber 1230000.0, { lines = > [|"123e4"|]<br /> position = { line = 1<br /> column = > 0 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JNumber > 1230000.0</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr> > <td>Item</td><td><div class="dni-plaintext"><pre>1230000.0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|"123e4"|]<br /> position = { line = 1<br /> > column = 0 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ 123e4 > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 1<br /> > column = 0 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>1 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 29.43ms - stdout ] ──────────────────────────────────────────────────────── > │ JNumber 1230000.0 > │ JNumber 1230000.0 > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jNumber_ "123.4e5" > |> parserEqual (Success (JNumber 12340000.0)) > > ── [ 25.43ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JNumber 12340000.0, { lines = > [|"123.4e5"|]<br /> position = { line = > 1<br /> column = 0 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JNumber 12340000.0, { lines = > [|"123.4e5"|]<br /> position = { line = 1<br /> column > = 0 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JNumber > 12340000.0</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr > ><td>Item</td><td><div class="dni-plaintext"><pre>12340000.0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|"123.4e5"|]<br /> position = { line = 1<br /> > column = 0 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ 123.4e5 > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 1<br /> > column = 0 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>1 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 27.15ms - stdout ] ──────────────────────────────────────────────────────── > │ JNumber 12340000.0 > │ JNumber 12340000.0 > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jNumber_ "123.4e-5" > |> parserEqual (Success (JNumber 0.001234)) > > ── [ 23.48ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JNumber 0.001234, { lines = > [|"123.4e-5"|]<br /> position = { line = > 1<br /> column = 0 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JNumber 0.001234, { lines = > [|"123.4e-5"|]<br /> position = { line = 1<br /> column > = 0 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JNumber > 0.001234</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr>< > td>Item</td><td><div class="dni-plaintext"><pre>0.001234 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>Item2</t > d><td><details class="dni-treeview"><summary><span class="dni-code-hint"><code>{ > lines = [|"123.4e-5"|]<br /> position = { line = 1<br /> > column = 0 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ 123.4e-5 > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 1<br /> > column = 0 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>1 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 25.24ms - stdout ] ──────────────────────────────────────────────────────── > │ JNumber 0.001234 > │ JNumber 0.001234 > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### jArray > > ── fsharp ────────────────────────────────────────────────────────────────────── > let jArray = > let left = pchar '[[' .>> spaces > let right = pchar ']]' .>> spaces > let comma = pchar ',' .>> spaces > let value = jValue .>> spaces > > let values = sepBy value comma > > between left values right > |>> JArray > <?> "array" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > jValueRef <| > choice > [[ > jNull > jBool > jString > jNumber > jArray > ]] > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jArray "[[ 1, 2 ]]" > |> parserEqual (Success (JArray [[ JNumber 1.0; JNumber 2.0 ]])) > > ── [ 57.68ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success (JArray [JNumber 1.0; JNumber 2.0], { lines > = [|"[ 1, 2 ]"|]<br /> > position = { line = 1<br /> > column = 0 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JArray [JNumber 1.0; JNumber 2.0], { lines = > [|"[ 1, 2 ]"|]<br /> position = { line = 1<br /> column > = 0 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JArray [JNumber 1.0; JNumber > 2.0]</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>I > tem</td><td><table><thead><tr><th><i>index</i></th><th>value</th></tr></thead><t > body><tr><td>0</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JNumber > 1.0</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>It > em</td><td><div class="dni-plaintext"><pre>1.0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td>1</td><t > d><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JNumber > 2.0</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>It > em</td><td><div class="dni-plaintext"><pre>2.0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </td></tr></tbody></table></div></details></td></tr><tr><td>Item2</td><td><detai > ls class="dni-treeview"><summary><span class="dni-code-hint"><code>{ lines = > [|"[ 1, 2 ]"|]<br /> position = { line = 1<br /> column > = 0 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ [ 1, 2 ] > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 1<br /> > column = 0 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>1 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 59.77ms - stdout ] ──────────────────────────────────────────────────────── > │ JArray [JNumber 1.0; JNumber 2.0] > │ JArray [JNumber 1.0; JNumber 2.0] > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jArray "[[ 1, 2, ]]" > |> parserEqual ( > Failure ( > "array", > "Unexpected ','", > { currentLine = "[[ 1, 2, ]]"; line = 0; column = 6 } > ) > ) > > ── [ 24.73ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Failure ("array", "Unexpected > ','", { currentLine = "[ 1, 2, ]"<br /> > line = 0<br /> column = 6 > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><div class="dni-plaintext"><pre>"array" > │ </pre></div></td></tr><tr><td>Item2</td><td><div > class="dni-plaintext"><pre>"Unexpected ','" > │ </pre></div></td></tr><tr><td>Item3</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ currentLine = > "[ 1, 2, ]"<br /> line = 0<br /> column = 6 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>curr > entLine</td><td><div class="dni-plaintext"><pre>"[ 1, 2, ]" > │ </pre></div></td></tr><tr><td>line</td><td><div > class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>6 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 25.97ms - stdout ] ──────────────────────────────────────────────────────── > │ Line:0 Col:6 Error parsing array > │ [ 1, 2, ] > │ ^Unexpected ',' > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### jObject > > ── fsharp ────────────────────────────────────────────────────────────────────── > let jObject = > let left = spaces >>. pchar '{' .>> spaces > let right = pchar '}' .>> spaces > let colon = pchar ':' .>> spaces > let comma = pchar ',' .>> spaces > let key = quotedString .>> spaces > let value = jValue .>> spaces > > let keyValue = (key .>> colon) .>>. value > let keyValues = sepBy keyValue comma > > between left keyValues right > |>> Map.ofList > |>> JObject > <?> "object" > > ── fsharp ────────────────────────────────────────────────────────────────────── > jValueRef <| > choice > [[ > jNull > jBool > jString > jNumber > jArray > jObject > ]] > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jObject """{ "a":1, "b" : 2 }""" > |> parserEqual ( > Success ( > JObject ( > Map.ofList [[ > "a", JNumber 1.0 > "b", JNumber 2.0 > ]] > ) > ) > ) > > ── [ 61.96ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success<br /> (JObject (map [("a", > JNumber 1.0); ("b", JNumber 2.0)]),<br /> { lines = [|"{ > "a":1, "b" : 2 }"|]<br /> position = { line = > 1<br /> column = 0 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JObject (map [("a", JNumber 1.0); > ("b", JNumber 2.0)]), { lines = [|"{ "a":1, > "b" : 2 }"|]<br /> position = { line = 1<br /> > column = 0 } > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JObject (map [("a", JNumber 1.0); > ("b", JNumber > 2.0)])</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td > >Item</td><td><table><thead><tr><th><i>key</i></th><th>value</th></tr></thead><t > body><tr><td><div class="dni-plaintext"><pre>"a" > │ </pre></div></td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>JNumber > 1.0</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>It > em</td><td><div class="dni-plaintext"><pre>1.0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr><tr><td><div > class="dni-plaintext"><pre>"b" > │ > </pre></div>...</details></td></tr></tbody></table></td></tr></tbody></table></d > iv></details></td></tr><tr><td>Item2</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ lines = > [|"{ "a":1, "b" : 2 }"|]<br /> position = { > line = 1<br /> column = 0 } > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > s</td><td><div class="dni-plaintext"><pre>[ { "a":1, "b" : > 2 } ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 1<br /> > column = 0 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>1 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 64.22ms - stdout ] ──────────────────────────────────────────────────────── > │ JObject (map [("a", JNumber 1.0); ("b", JNumber 2.0)]) > │ JObject (map [("a", JNumber 1.0); ("b", JNumber 2.0)]) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run jObject """{ "a":1, "b" : 2, }""" > |> parserEqual ( > Failure ( > "object", > "Unexpected ','", > { currentLine = """{ "a":1, "b" : 2, }"""; line = 0; column = 18 } > ) > ) > > ── [ 27.58ms - return value ] ────────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Failure ("object", "Unexpected > ','", { currentLine = "{ "a":1, "b" : 2, > }"<br /> line = 0<br /> > column = 18 > })</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Ite > m1</td><td><div class="dni-plaintext"><pre>"object" > │ </pre></div></td></tr><tr><td>Item2</td><td><div > class="dni-plaintext"><pre>"Unexpected ','" > │ </pre></div></td></tr><tr><td>Item3</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ currentLine = > "{ "a":1, "b" : 2, }"<br /> line = 0<br /> > column = 18 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>curr > entLine</td><td><div class="dni-plaintext"><pre>"{ "a":1, > "b" : 2, }" > │ </pre></div></td></tr><tr><td>line</td><td><div > class="dni-plaintext"><pre>0 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>18 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 28.80ms - stdout ] ──────────────────────────────────────────────────────── > │ Line:0 Col:18 Error parsing object > │ { "a":1, "b" : 2, } > │ ^Unexpected ',' > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### jValue > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let example1 = """{ > "name" : "Scott", > "isMale" : true, > "bday" : {"year":2001, "month":12, "day":25 }, > "favouriteColors" : [["blue", "green"]], > "emptyArray" : [[]], > "emptyObject" : {} > }""" > run jValue example1 > |> parserEqual ( > Success ( > JObject ( > Map.ofList [[ > "name", JString "Scott" > "isMale", JBool true > "bday", JObject ( > Map.ofList [[ > "year", JNumber 2001.0 > "month", JNumber 12.0 > "day", JNumber 25.0 > ]] > ) > "favouriteColors", JArray [[ JString "blue"; JString "green" ]] > "emptyArray", JArray [[]] > "emptyObject", JObject Map.empty > ]] > ) > ) > ) > > ── [ 109.63ms - return value ] ───────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success<br /> (JObject<br /> (map<br /> > [("bday",<br /> JObject<br /> (map<br /> > [("day", JNumber 25.0); ("month", JNumber 12.0);<br /> > ("year", JNumber 2001.0)])); ("emptyArray", JArray []);<br > /> ("emptyObject", JObject (map []));<br /> > ("favouriteColors", > ...</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>It > em</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JObject<br /> (map<br /> > [("bday",<br /> JObject<br /> (map<br /> > [("day", JNumber 25.0); ("month", JNumber 12.0);<br /> > ("year", JNumber 2001.0)])); ("emptyArray", JArray []);<br > /> ("emptyObject", JObject (map []));<br /> > ("favouriteColors", JArray [JString "blue"; JString > "gr...</code></span></summary><div><table><thead><tr></tr></thead><tbody><t > r><td>Item1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JObject<br /> (map<br /> [("bday",<br > /> JObject<br /> (map<br /> [("day", JNumber > 25.0); ("month", JNumber 12.0);<br /> ("year", > JNumber 2001.0)])); ("emptyArray", JArra...= 8<br /> > column = 0 } > ...</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>li > nes</td><td><div class="dni-plaintext"><pre>[ {, "name" : > "Scott",, "isMale" : true,, "bday" : > {"year":2001, "month":12, "day":25 },, > "favouriteColors" : ["blue", "green"],, > "emptyArray" : [],, "emptyObject" : {}, } > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 8<br /> > column = 0 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>8 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 111.46ms - stdout ] ─────────────────────────────────────────────────────── > │ JObject > │ (map > │ [("bday", > │ JObject > │ (map > │ [("day", JNumber 25.0); ("month", JNumber 12.0); > │ ("year", JNumber 2001.0)])); ("emptyArray", > JArray []); > │ ("emptyObject", JObject (map [])); > │ ("favouriteColors", JArray [JString "blue"; JString > "green"]); > │ ("isMale", JBool true); ("name", JString "Scott")]) > │ JObject > │ (map > │ [("bday", JObject (map [("day", JNumber 25.0); ("month", > JNumber 12.0); ("year", JNumber 2001.0)])); > │ ("emptyArray", JArray []); ("emptyObject", JObject (map > [])); > │ ("favouriteColors", JArray [JString "blue"; JString > "green"]); ("isMale", JBool true); ("name", JString "Scott")]) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let example2 = """{"widget": { > "debug": "on", > "window": { > "title": "Sample Konfabulator Widget", > "name": "main_window", > "width": 500, > "height": 500 > }, > "image": { > "src": "Images/Sun.png", > "name": "sun1", > "hOffset": 250, > "vOffset": 250, > "alignment": "center" > }, > "text": { > "data": "Click Here", > "size": 36, > "style": "bold", > "name": "text1", > "hOffset": 250, > "vOffset": 100, > "alignment": "center", > "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;" > } > }}""" > > run jValue example2 > |> parserEqual ( > Success ( > JObject ( > Map.ofList [[ > "widget", JObject ( > Map.ofList [[ > "debug", JString "on" > "window", JObject ( > Map.ofList [[ > "title", JString "Sample Konfabulator Widget" > "name", JString "main_window" > "width", JNumber 500.0 > "height", JNumber 500.0 > ]] > ) > "image", JObject ( > Map.ofList [[ > "src", JString "Images/Sun.png" > "name", JString "sun1" > "hOffset", JNumber 250.0 > "vOffset", JNumber 250.0 > "alignment", JString "center" > ]] > ) > "text", JObject ( > Map.ofList [[ > "data", JString "Click Here" > "size", JNumber 36.0 > "style", JString "bold" > "name", JString "text1" > "hOffset", JNumber 250.0 > "vOffset", JNumber 100.0 > "alignment", JString "center" > "onMouseUp", JString "sun1.opacity = > (sun1.opacity / 100) * 90;" > ]] > ) > ]] > ) > ]] > ) > ) > ) > > ── [ 220.38ms - return value ] ───────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success<br /> (JObject<br /> (map<br /> > [("widget",<br /> JObject<br /> (map<br /> > [("debug", JString "on");<br /> > ("image",<br /> JObject<br /> > (map<br /> [("alignment", JString > "center");<br /> > ("hOffset"...</code></span></summary><div><table><thead><tr></tr></the > ad><tbody><tr><td>Item</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JObject<br /> (map<br /> > [("widget",<br /> JObject<br /> (map<br /> > [("debug", JString "on");<br /> > ("image",<br /> JObject<br /> (map<br /> > [("alignment", JString "center"); ("hOffset", > JNumber 250.0);<br /> ("name", JString > "sun1"...</code></span></summary><div><table><thead><tr></tr></thead>< > tbody><tr><td>Item1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JObject<br /> (map<br /> > [("widget",<br /> JObject<br /> (map<br /> > [("debug", JString "on");<br /> > ("image",<br /> JObject<br /> (... > "alignment": "center", },, "text": {, > "data": "Click Here",, "size": 36,, > "style": "bold",, "name": > "text1",, "hOffset": 250,, > "vOffset": 100,, "alignment": "center",, > "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;", > }, }} ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 26<br > /> column = 0 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>26 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 222.10ms - stdout ] ─────────────────────────────────────────────────────── > │ JObject > │ (map > │ [("widget", > │ JObject > │ (map > │ [("debug", JString "on"); > │ ("image", > │ JObject > │ (map > │ [("alignment", JString "center"); > ("hOffset", JNumber 250.0); > │ ("name", JString "sun1"); ("src", JString > "Images/Sun.png"); > │ ("vOffset", JNumber 250.0)])); > │ ("text", > │ JObject > │ (map > │ [("alignment", JString "center"); > │ ("data", JString "Click Here"); > ("hOffset", JNumber 250.0); > │ ("name", JString "text1"); > │ ("onMouseUp", > │ JString "sun1.opacity = (sun1.opacity / > 100) * 90;"); > │ ("size", JNumber 36.0); ("style", JString > "bold"); > │ ("vOffset", JNumber 100.0)])); > │ ("window", > │ JObject > │ (map > │ [("height", JNumber 500.0); ("name", > JString "main_window"); > │ ("title", JString "Sample Konfabulator > Widget"); > │ ("width", JNumber 500.0)]))]))]) > │ JObject > │ (map > │ [("widget", > │ JObject > │ (map > │ [("debug", JString "on"); > │ ("image", > │ JObject > │ (map > │ [("alignment", JString "center"); > ("hOffset", JNumber 250.0); ("name", JString "sun1"); > │ ("src", JString "Images/Sun.png"); > ("vOffset", JNumber 250.0)])); > │ ("text", > │ JObject > │ (map > │ [("alignment", JString "center"); ("data", > JString "Click Here"); ("hOffset", JNumber 250.0); > │ ("name", JString "text1"); ("onMouseUp", > JString "sun1.opacity = (sun1.opacity / 100) * 90;"); > │ ("size", JNumber 36.0); ("style", JString > "bold"); ("vOffset", JNumber 100.0)])); > │ ("window", > │ JObject > │ (map > │ [("height", JNumber 500.0); ("name", > JString "main_window"); > │ ("title", JString "Sample Konfabulator > Widget"); ("width", JNumber 500.0)]))]))]) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let example3 = """{ > "string": "Hello, \"World\"!", > "escapedString": "This string contains \\/\\\\\\b\\f\\n\\r\\t\\\"\\'", > "number": 42, > "scientificNumber": 3.14e-10, > "boolean": true, > "nullValue": null, > "array": [[1, 2, 3, 4, 5]], > "unicodeString1": "프리마", > "unicodeString2": "\u0048\u0065\u006C\u006C\u006F, > \u0022\u0057\u006F\u0072\u006C\u0064\u0022!", > "specialCharacters": "!@#$%^&*()", > "emptyArray": [[]], > "emptyObject": {}, > "nestedArrays": [[[[1, 2, 3]], [[4, 5, 6]]]], > "object": { > "nestedString": "Nested Value", > "nestedNumber": 3.14, > "nestedBoolean": false, > "nestedNull": null, > "nestedArray": [["a", "b", "c"]], > "nestedObject": { > "nestedProperty": "Nested Object Value" > } > }, > "nestedObjects": [[ > {"name": "Alice", "age": 25}, > {"name": "Bob", "age": 30} > ]] > }""" > run jValue example3 > |> parserEqual ( > Success ( > JObject ( > Map.ofList [[ > "string", JString @"Hello, ""World""!" > "escapedString", JString @"This string contains > \/\\\b\f\n\r\t\""\'" > "number", JNumber 42.0 > "scientificNumber", JNumber 3.14e-10 > "boolean", JBool true > "nullValue", JNull > "array", JArray [[ > JNumber 1.0; JNumber 2.0; JNumber 3.0; JNumber 4.0; JNumber > 5.0 > ]] > "unicodeString1", JString "프리마" > "unicodeString2", JString @"Hello, ""World""!" > "specialCharacters", JString "!@#$%^&*()" > "emptyArray", JArray [[]] > "emptyObject", JObject Map.empty > "nestedArrays", JArray [[ > JArray [[ JNumber 1.0; JNumber 2.0; JNumber 3.0 ]] > JArray [[ JNumber 4.0; JNumber 5.0; JNumber 6.0 ]] > ]] > "object", JObject ( > Map.ofList [[ > "nestedString", JString "Nested Value" > "nestedNumber", JNumber 3.14 > "nestedBoolean", JBool false > "nestedNull", JNull > "nestedArray", JArray [[JString "a"; JString "b"; > JString "c"]] > "nestedObject", JObject ( > Map.ofList [[ > "nestedProperty", JString "Nested Object Value" > ]] > ) > ]] > ) > "nestedObjects", JArray [[ > JObject (Map.ofList [[ "name", JString "Alice"; "age", JNumber > 25.0 ]]) > JObject (Map.ofList [[ "name", JString "Bob"; "age", JNumber > 30.0 ]]) > ]] > ]] > ) > ) > ) > > ── [ 302.94ms - return value ] ───────────────────────────────────────────────── > │ <details open="open" class="dni-treeview"><summary><span > class="dni-code-hint"><code>Success<br /> (JObject<br /> (map<br /> > [("array",<br /> JArray<br /> [JNumber 1.0; > JNumber 2.0; JNumber 3.0; JNumber 4.0; JNumber 5.0]);<br /> > ("boolean", JBool true); ("emptyArray", JArray []);<br /> > ("emptyObject", JObject (map []));<br /> > ("escapedString", JString "This > s...</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>I > tem</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>(JObject<br /> (map<br /> > [("array",<br /> JArray [JNumber 1.0; JNumber 2.0; JNumber 3.0; > JNumber 4.0; JNumber 5.0]);<br /> ("boolean", JBool true); > ("emptyArray", JArray []);<br /> ("emptyObject", > JObject (map []));<br /> ("escapedString", JString "This > string contains \/\\\b\f<br />\r\t\"\'");<br /> > ...</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>It > em1</td><td><details class="dni-treeview"><summary><span > class="dni-code-hint"><code>JObject<br /> (map<br /> > [("array",<br /> JArray [JNumber 1.0; JNumber 2.0; JNumber 3.0; > JNumber 4.0; JNumber 5.0]);<br /> ("boolean", JBool true); > ("emptyArray", JArray []);<br /> ("emptyObject", > JObject (map []));<br /> ("es...quot;,, "nestedNumber": > 3.14,, "nestedBoolean": false,, "nestedNull": null,, > "nestedArray": ["a", "b", "c"],, > "nestedObject": {, "nestedProperty": "Nested > Object Value", }, },, "nestedObjects": [, > {"name": "Alice", "age": 25},, > {"name": "Bob", "age": 30}, ], } > ]</pre></div></td></tr><tr><td>position</td><td><details > class="dni-treeview"><summary><span class="dni-code-hint"><code>{ line = 29<br > /> column = 0 > }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>line > </td><td><div class="dni-plaintext"><pre>29 > │ </pre></div></td></tr><tr><td>column</td><td><div > class="dni-plaintext"><pre>0 > │ > </pre></div></td></tr></tbody></table></div></details></td></tr></tbody></table> > </div></details></td></tr></tbody></table></div></details></td></tr></tbody></ta > ble></div></details><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> > > ── [ 304.72ms - stdout ] ─────────────────────────────────────────────────────── > │ JObject > │ (map > │ [("array", > │ JArray [JNumber 1.0; JNumber 2.0; JNumber 3.0; JNumber > 4.0; JNumber 5.0]); > │ ("boolean", JBool true); ("emptyArray", JArray []); > │ ("emptyObject", JObject (map [])); > │ ("escapedString", JString "This string contains > \/\\\b\f\n\r\t\"\'"); > │ ("nestedArrays", > │ JArray > │ [JArray [JNumber 1.0; JNumber 2.0; JNumber 3.0]; > │ JArray [JNumber 4.0; JNumber 5.0; JNumber 6.0]]); > │ ("nestedObjects", > │ JArray > │ [JObject (map [("age", JNumber 25.0); ("name", > JString "Alice")]); > │ JObject (map [("age", JNumber 30.0); ("name", > JString "Bob")])]); > │ ("nullValue", JNull); ("number", JNumber 42.0); ...]) > │ JObject > │ (map > │ [("array", JArray [JNumber 1.0; JNumber 2.0; JNumber > 3.0; JNumber 4.0; JNumber 5.0]); ("boolean", JBool true); > │ ("emptyArray", JArray []); ("emptyObject", JObject (map > [])); > │ ("escapedString", JString "This string contains > \/\\\b\f\n\r\t\"\'"); > │ ("nestedArrays", > │ JArray [JArray [JNumber 1.0; JNumber 2.0; JNumber > 3.0]; JArray [JNumber 4.0; JNumber 5.0; JNumber 6.0]]); > │ ("nestedObjects", > │ JArray > │ [JObject (map [("age", JNumber 25.0); ("name", > JString "Alice")]); > │ JObject (map [("age", JNumber 30.0); ("name", > JString "Bob")])]); ("nullValue", JNull); > │ ("number", JNumber 42.0); ...]) > │ > │ 00:00:18 v #3 runtime.execute_with_options / result / { file_name = dotnet; exit_code = 0; std_trace_length = 154931 } 00:00:18 d #4 runtime.execute_with_options / { file_name = jupyter; arguments = ["nbconvert", "/home/runner/work/polyglot/polyglot/apps/parser/JsonParser.dib.ipynb", "--to", "html", "--HTMLExporter.theme=dark"]; options = { command = jupyter nbconvert "/home/runner/work/polyglot/polyglot/apps/parser/JsonParser.dib.ipynb" --to html --HTMLExporter.theme=dark; cancellation_token = None; environment_variables = Array(MutCell([])); on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:00:19 v #5 ! [NbConvertApp] Converting notebook /home/runner/work/polyglot/polyglot/apps/parser/JsonParser.dib.ipynb to html 00:00:19 v #6 ! /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/nbformat/__init__.py:96: MissingIDFieldWarning: Cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future. 00:00:19 v #7 ! validate(nb) 00:00:19 v #8 ! /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/nbconvert/filters/highlight.py:71: UserWarning: IPython3 lexer unavailable, falling back on Python 3 00:00:19 v #9 ! return _pygments_highlight( 00:00:20 v #10 ! [NbConvertApp] Writing 500494 bytes to /home/runner/work/polyglot/polyglot/apps/parser/JsonParser.dib.html 00:00:20 v #11 runtime.execute_with_options / result / { file_name = jupyter; exit_code = 0; std_trace_length = 908 } 00:00:20 d #12 spiral.process_dib / dib / jupyter nbconvert / { exit_code = 0; jupyter_result_length = 908 } 00:00:20 d #13 runtime.execute_with_options / { file_name = pwsh; arguments = ["-c", "$counter = 1; $path = '/home/runner/work/polyglot/polyglot/apps/parser/JsonParser.dib.html'; (Get-Content $path -Raw) -replace '(id=\\\"cell-id=)[a-fA-F0-9]{8}', { $_.Groups[1].Value + $counter++ } | Set-Content $path"]; options = { command = pwsh -c "$counter = 1; $path = '/home/runner/work/polyglot/polyglot/apps/parser/JsonParser.dib.html'; (Get-Content $path -Raw) -replace '(id=\"cell-id=)[a-fA-F0-9]{8}', { $_.Groups[1].Value + $counter++ } | Set-Content $path"; cancellation_token = None; environment_variables = Array(MutCell([])); on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:00:20 v #14 runtime.execute_with_options / result / { file_name = pwsh; exit_code = 0; std_trace_length = 0 } 00:00:20 d #15 spiral.run / dib / html cell ids / { exit_code = 0; pwsh_replace_html_result_length = 0 } 00:00:20 d #16 spiral.process_dib / dib / { exit_code = 0; result_length = 155898 } 00:00:00 d #1 spiral.main / { args = Array(MutCell(["dib", "--path", "Parser.dib"])) } 00:00:00 d #2 runtime.execute_with_options / { file_name = dotnet; arguments = ["repl", "--exit-after-run", "--run", "/home/runner/work/polyglot/polyglot/apps/parser/Parser.dib", "--output-path", "/home/runner/work/polyglot/polyglot/apps/parser/Parser.dib.ipynb"]; options = { command = dotnet repl --exit-after-run --run "/home/runner/work/polyglot/polyglot/apps/parser/Parser.dib" --output-path "/home/runner/work/polyglot/polyglot/apps/parser/Parser.dib.ipynb"; cancellation_token = None; environment_variables = Array(MutCell([("TRACE_LEVEL", "Verbose"), ("AUTOMATION", "True")])); on_line = None; stdin = None; trace = false; working_directory = None; stderr = true } } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ # Parser (Polyglot) > > ── fsharp ────────────────────────────────────────────────────────────────────── > open Common > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### TextInput > > ── fsharp ────────────────────────────────────────────────────────────────────── > type Position = > { > line : int > column : int > } > > ── fsharp ────────────────────────────────────────────────────────────────────── > let initialPos = { line = 0; column = 0 } > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline incrCol (pos : Position) = > { pos with column = pos.column + 1 } > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline incrLine pos = > { line = pos.line + 1; column = 0 } > > ── fsharp ────────────────────────────────────────────────────────────────────── > type InputState = > { > lines : string[[]] > position : Position > } > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline fromStr str = > { > lines = > if str |> String.IsNullOrEmpty > then [[||]] > else str |> SpiralSm.split_string [[| "\r\n"; "\n" |]] > position = initialPos > } > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > fromStr "" |> _assertEqual { > lines = [[||]] > position = { line = 0; column = 0 } > } > > ── [ 37.72ms - stdout ] ──────────────────────────────────────────────────────── > │ { lines = [||] > │ position = { line = 0 > │ column = 0 } } > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > fromStr "Hello \n World" |> _assertEqual { > lines = [[| "Hello "; " World" |]] > position = { line = 0; column = 0 } > } > > ── [ 14.63ms - stdout ] ──────────────────────────────────────────────────────── > │ { lines = [|"Hello "; " World"|] > │ position = { line = 0 > │ column = 0 } } > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline currentLine inputState = > let linePos = inputState.position.line > if linePos < inputState.lines.Length > then inputState.lines.[[linePos]] > else "end of file" > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline nextChar input = > let linePos = input.position.line > let colPos = input.position.column > > if linePos >= input.lines.Length > then input, None > else > let currentLine = currentLine input > if colPos < currentLine.Length then > let char = currentLine.[[colPos]] > let newPos = incrCol input.position > let newState = { input with position = newPos } > newState, Some char > else > let char = '\n' > let newPos = incrLine input.position > let newState = { input with position = newPos } > newState, Some char > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let newInput, charOpt = fromStr "Hello World" |> nextChar > > newInput |> _assertEqual { > lines = [[| "Hello World" |]] > position = { line = 0; column = 1 } > } > charOpt |> _assertEqual (Some 'H') > > ── [ 28.24ms - stdout ] ──────────────────────────────────────────────────────── > │ { lines = [|"Hello World"|] > │ position = { line = 0 > │ column = 1 } } > │ > │ Some 'H' > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let newInput, charOpt = fromStr "Hello\n\nWorld" |> nextChar > > newInput |> _assertEqual { > lines = [[| "Hello"; ""; "World" |]] > position = { line = 0; column = 1 } > } > charOpt |> _assertEqual (Some 'H') > > ── [ 20.04ms - stdout ] ──────────────────────────────────────────────────────── > │ { lines = [|"Hello"; ""; "World"|] > │ position = { line = 0 > │ column = 1 } } > │ > │ Some 'H' > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### Parser > > ── fsharp ────────────────────────────────────────────────────────────────────── > type Input = InputState > type ParserLabel = string > type ParserError = string > > type ParserPosition = > { > currentLine : string > line : int > column : int > } > > type ParseResult<'a> = > | Success of 'a > | Failure of ParserLabel * ParserError * ParserPosition > > type Parser<'a> = > { > label : ParserLabel > parseFn : Input -> ParseResult<'a * Input> > } > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline printResult result = > match result with > | Success (value, input) -> > printfn $"%A{value}" > | Failure (label, error, parserPos) -> > let errorLine = parserPos.currentLine > let colPos = parserPos.column > let linePos = parserPos.line > let failureCaret = $"{' ' |> string |> String.replicate colPos}^{error}" > printfn $"Line:%i{linePos} Col:%i{colPos} Error parsing > %s{label}\n%s{errorLine}\n%s{failureCaret}" > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline runOnInput parser input = > parser.parseFn input > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline run parser inputStr = > runOnInput parser (fromStr inputStr) > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline parserPositionFromInputState (inputState : Input) = > { > currentLine = currentLine inputState > line = inputState.position.line > column = inputState.position.column > } > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline getLabel parser = > parser.label > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline setLabel parser newLabel = > { > label = newLabel > parseFn = fun input -> > match parser.parseFn input with > | Success s -> Success s > | Failure (oldLabel, err, pos) -> Failure (newLabel, err, pos) > } > > ── fsharp ────────────────────────────────────────────────────────────────────── > let (<?>) = setLabel > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline satisfy predicate label = > { > label = label > parseFn = fun input -> > let remainingInput, charOpt = nextChar input > match charOpt with > | None -> > let err = "No more input" > let pos = parserPositionFromInputState input > Failure (label, err, pos) > | Some first -> > if predicate first > then Success (first, remainingInput) > else > let err = $"Unexpected '%c{first}'" > let pos = parserPositionFromInputState input > Failure (label, err, pos) > } > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "Hello" > let parser = satisfy (fun c -> c = 'H') "H" > runOnInput parser input |> _assertEqual ( > Success ( > 'H', > { > lines = [[| "Hello" |]] > position = { line = 0; column = 1 } > } > ) > ) > > ── [ 26.01ms - stdout ] ──────────────────────────────────────────────────────── > │ Success ('H', { lines = [|"Hello"|] > │ position = { line = 0 > │ column = 1 } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "World" > let parser = satisfy (fun c -> c = 'H') "H" > runOnInput parser input |> _assertEqual ( > Failure ( > "H", > "Unexpected 'W'", > { > currentLine = "World" > line = 0 > column = 0 > } > ) > ) > > ── [ 21.81ms - stdout ] ──────────────────────────────────────────────────────── > │ Failure ("H", "Unexpected 'W'", { currentLine = "World" > │ line = 0 > │ column = 0 }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline bindP f p = > { > label = "unknown" > parseFn = fun input -> > match runOnInput p input with > | Failure (label, err, pos) -> Failure (label, err, pos) > | Success (value1, remainingInput) -> runOnInput (f value1) > remainingInput > } > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline (>>=) p f = bindP f p > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "Hello" > let parser = satisfy (fun c -> c = 'H') "H" > let parser2 = parser >>= fun c -> satisfy (fun c -> c = 'e') "e" > runOnInput parser2 input |> _assertEqual ( > Success ( > 'e', > { > lines = [[| "Hello" |]] > position = { line = 0; column = 2 } > } > ) > ) > > ── [ 28.12ms - stdout ] ──────────────────────────────────────────────────────── > │ Success ('e', { lines = [|"Hello"|] > │ position = { line = 0 > │ column = 2 } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "World" > let parser = satisfy (fun c -> c = 'W') "W" > let parser2 = parser >>= fun c -> satisfy (fun c -> c = 'e') "e" > runOnInput parser2 input |> _assertEqual ( > Failure ( > "e", > "Unexpected 'o'", > { > currentLine = "World" > line = 0 > column = 1 > } > ) > ) > > ── [ 28.73ms - stdout ] ──────────────────────────────────────────────────────── > │ Failure ("e", "Unexpected 'o'", { currentLine = "World" > │ line = 0 > │ column = 1 }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline returnP x = > { > label = $"%A{x}" > parseFn = fun input -> Success (x, input) > } > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "Hello" > let parser = returnP "Hello" > runOnInput parser input |> _assertEqual ( > Success ( > "Hello", > { > lines = [[| "Hello" |]] > position = { line = 0; column = 0 } > } > ) > ) > > ── [ 17.42ms - stdout ] ──────────────────────────────────────────────────────── > │ Success ("Hello", { lines = [|"Hello"|] > │ position = { line = 0 > │ column = 0 } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline mapP f = > bindP (f >> returnP) > > ── fsharp ────────────────────────────────────────────────────────────────────── > let (<!>) = mapP > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline (|>>) x f = f <!> x > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "Hello" > let parser = satisfy (fun c -> c = 'H') "H" > let parser2 = parser |>> string > runOnInput parser2 input |> _assertEqual ( > Success ( > "H", > { > lines = [[| "Hello" |]] > position = { line = 0; column = 1 } > } > ) > ) > > ── [ 25.06ms - stdout ] ──────────────────────────────────────────────────────── > │ Success ("H", { lines = [|"Hello"|] > │ position = { line = 0 > │ column = 1 } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline applyP fP xP = > fP >>= > fun f -> > xP >>= > fun x -> > returnP (f x) > > ── fsharp ────────────────────────────────────────────────────────────────────── > let (<*>) = applyP > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline lift2 f xP yP = > returnP f <*> xP <*> yP > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "Hello" > let parser = satisfy (fun c -> c = 'H') "H" > let parser2 = satisfy (fun c -> c = 'e') "e" > let parser3 = lift2 (fun c1 c2 -> string c1 + string c2) parser parser2 > runOnInput parser3 input |> _assertEqual ( > Success ( > "He", > { > lines = [[| "Hello" |]] > position = { line = 0; column = 2 } > } > ) > ) > > ── [ 44.71ms - stdout ] ──────────────────────────────────────────────────────── > │ Success ("He", { lines = [|"Hello"|] > │ position = { line = 0 > │ column = 2 } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline andThen p1 p2 = > p1 >>= > fun p1Result -> > p2 >>= > fun p2Result -> > returnP (p1Result, p2Result) > <?> $"{getLabel p1} andThen {getLabel p2}" > > ── fsharp ────────────────────────────────────────────────────────────────────── > let (.>>.) = andThen > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "Hello" > let parser = satisfy (fun c -> c = 'H') "H" > let parser2 = satisfy (fun c -> c = 'e') "e" > let parser3 = parser .>>. parser2 > runOnInput parser3 input |> _assertEqual ( > Success ( > ('H', 'e'), > { > lines = [[| "Hello" |]] > position = { line = 0; column = 2 } > } > ) > ) > > ── [ 30.04ms - stdout ] ──────────────────────────────────────────────────────── > │ Success (('H', 'e'), { lines = [|"Hello"|] > │ position = { line = 0 > │ column = 2 } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline orElse p1 p2 = > { > label = $"{getLabel p1} orElse {getLabel p2}" > parseFn = fun input -> > match runOnInput p1 input with > | Success _ as result -> result > | Failure _ -> runOnInput p2 input > } > > ── fsharp ────────────────────────────────────────────────────────────────────── > let (<|>) = orElse > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "hello" > let parser = satisfy (fun c -> c = 'H') "H" > let parser2 = satisfy (fun c -> c = 'h') "h" > let parser3 = parser <|> parser2 > runOnInput parser3 input |> _assertEqual ( > Success ( > 'h', > { > lines = [[| "hello" |]] > position = { line = 0; column = 1 } > } > ) > ) > > ── [ 26.44ms - stdout ] ──────────────────────────────────────────────────────── > │ Success ('h', { lines = [|"hello"|] > │ position = { line = 0 > │ column = 1 } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline choice listOfParsers = > listOfParsers |> List.reduce (<|>) > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "hello" > let parser = satisfy (fun c -> c = 'H') "H" > let parser2 = satisfy (fun c -> c = 'h') "h" > let parser3 = choice [[ parser; parser2 ]] > runOnInput parser3 input |> _assertEqual ( > Success ( > 'h', > { > lines = [[| "hello" |]] > position = { line = 0; column = 1 } > } > ) > ) > > ── [ 25.70ms - stdout ] ──────────────────────────────────────────────────────── > │ Success ('h', { lines = [|"hello"|] > │ position = { line = 0 > │ column = 1 } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let rec sequence parserList = > match parserList with > | [[]] -> returnP [[]] > | head :: tail -> (lift2 cons) head (sequence tail) > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "Hello" > let parser = satisfy (fun c -> c = 'H') "H" > let parser2 = satisfy (fun c -> c = 'e') "e" > let parser3 = sequence [[ parser; parser2 ]] > runOnInput parser3 input |> _assertEqual ( > Success ( > [[ 'H'; 'e' ]], > { > lines = [[| "Hello" |]] > position = { line = 0; column = 2 } > } > ) > ) > > ── [ 35.81ms - stdout ] ──────────────────────────────────────────────────────── > │ Success (['H'; 'e'], { lines = [|"Hello"|] > │ position = { line = 0 > │ column = 2 } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let rec parseZeroOrMore parser input = > match runOnInput parser input with > | Failure (_, _, _) -> > [[]], input > | Success (firstValue, inputAfterFirstParse) -> > let subsequentValues, remainingInput = parseZeroOrMore parser > inputAfterFirstParse > firstValue :: subsequentValues, remainingInput > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline many parser = > { > label = $"many {getLabel parser}" > parseFn = fun input -> Success (parseZeroOrMore parser input) > } > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "hello" > let parser = satisfy (fun c -> c = 'H') "H" > let parser2 = many parser > runOnInput parser2 input |> _assertEqual ( > Success ( > [[]], > { > lines = [[| "hello" |]] > position = { line = 0; column = 0 } > } > ) > ) > > ── [ 24.55ms - stdout ] ──────────────────────────────────────────────────────── > │ Success ([], { lines = [|"hello"|] > │ position = { line = 0 > │ column = 0 } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline many1 p = > p >>= > fun head -> > many p >>= > fun tail -> > returnP (head :: tail) > <?> $"many1 {getLabel p}" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "hello" > let parser = satisfy (fun c -> c = 'H') "H" > let parser2 = many1 parser > runOnInput parser2 input |> _assertEqual ( > Failure ( > "many1 H", > "Unexpected 'h'", > { > currentLine = "hello" > line = 0 > column = 0 > } > ) > ) > > ── [ 33.19ms - stdout ] ──────────────────────────────────────────────────────── > │ Failure ("many1 H", "Unexpected 'h'", { currentLine = "hello" > │ line = 0 > │ column = 0 }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline opt p = > let some = p |>> Some > let none = returnP None > (some <|> none) > <?> $"opt {getLabel p}" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "hello" > let parser = satisfy (fun c -> c = 'H') "H" > let parser2 = opt parser > runOnInput parser2 input |> _assertEqual ( > Success ( > None, > { > lines = [[| "hello" |]] > position = { line = 0; column = 0 } > } > ) > ) > > ── [ 28.00ms - stdout ] ──────────────────────────────────────────────────────── > │ Success (None, { lines = [|"hello"|] > │ position = { line = 0 > │ column = 0 } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline (.>>) p1 p2 = > p1 .>>. p2 > |> mapP fst > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline (>>.) p1 p2 = > p1 .>>. p2 > |> mapP snd > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline between p1 p2 p3 = > p1 >>. p2 .>> p3 > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "[[Hello]]" > let parser = > between > (satisfy (fun c -> c = '[[') "[[") > (many (satisfy (fun c -> [[ 'a' .. 'z' ]] @ [[ 'A' .. 'Z' ]] |> > List.contains c) "letter")) > (satisfy (fun c -> c = ']]') "]]") > runOnInput parser input |> _assertEqual ( > Success ( > [[ 'H'; 'e'; 'l'; 'l'; 'o' ]], > { > lines = [[| "[[Hello]]" |]] > position = { line = 0; column = 7 } > } > ) > ) > > ── [ 85.35ms - stdout ] ──────────────────────────────────────────────────────── > │ Success (['H'; 'e'; 'l'; 'l'; 'o'], { lines = [|"[Hello]"|] > │ position = { line = 0 > │ column = 7 > } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline sepBy1 p sep = > let sepThenP = sep >>. p > p .>>. many sepThenP > |>> fun (p, pList) -> p :: pList > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline sepBy p sep = > sepBy1 p sep <|> returnP [[]] > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "Hello,World" > let parser = sepBy (many (satisfy (fun c -> c <> ',') "not comma")) (satisfy > (fun c -> c = ',') "comma") > runOnInput parser input |> _assertEqual ( > Success ( > [[ [[ 'H'; 'e'; 'l'; 'l'; 'o' ]]; [[ 'W'; 'o'; 'r'; 'l'; 'd'; '\n' ]] > ]], > { > lines = [[| "Hello,World" |]] > position = { line = 1; column = 0 } > } > ) > ) > > ── [ 55.16ms - stdout ] ──────────────────────────────────────────────────────── > │ Success ([['H'; 'e'; 'l'; 'l'; 'o']; ['W'; 'o'; 'r'; 'l'; > 'd'; '\010']], { lines = [|"Hello,World"|] > │ > position = { line = 1 > │ > > column = 0 } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline pchar charToMatch = > satisfy ((=) charToMatch) $"%c{charToMatch}" > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline anyOf listOfChars = > listOfChars > |> List.map pchar > |> choice > <?> $"anyOf %A{listOfChars}" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "Hello" > let parser = anyOf [[ 'H'; 'e'; 'l'; 'o' ]] |> many > runOnInput parser input |> _assertEqual ( > Success ( > [[ 'H'; 'e'; 'l'; 'l'; 'o' ]], > { > lines = [[| "Hello" |]] > position = { line = 0; column = 5 } > } > ) > ) > > ── [ 56.90ms - stdout ] ──────────────────────────────────────────────────────── > │ Success (['H'; 'e'; 'l'; 'l'; 'o'], { lines = [|"Hello"|] > │ position = { line = 0 > │ column = 5 > } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline charListToStr charList = > charList |> List.toArray |> String > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline manyChars cp = > many cp > |>> charListToStr > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline manyChars1 cp = > many1 cp > |>> charListToStr > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "Hello" > let parser = manyChars1 (anyOf [[ 'H'; 'e'; 'l'; 'o' ]]) > runOnInput parser input |> _assertEqual ( > Success ( > "Hello", > { > lines = [[| "Hello" |]] > position = { line = 0; column = 5 } > } > ) > ) > > ── [ 38.78ms - stdout ] ──────────────────────────────────────────────────────── > │ Success ("Hello", { lines = [|"Hello"|] > │ position = { line = 0 > │ column = 5 } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline pstring str = > str > |> List.ofSeq > |> List.map pchar > |> sequence > |> mapP charListToStr > <?> str > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "Hello" > let parser = pstring "Hello" > runOnInput parser input |> _assertEqual ( > Success ( > "Hello", > { > lines = [[| "Hello" |]] > position = { line = 0; column = 5 } > } > ) > ) > > ── [ 40.34ms - stdout ] ──────────────────────────────────────────────────────── > │ Success ("Hello", { lines = [|"Hello"|] > │ position = { line = 0 > │ column = 5 } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let whitespaceChar = > satisfy Char.IsWhiteSpace "whitespace" > > ── fsharp ────────────────────────────────────────────────────────────────────── > let spaces = many whitespaceChar > > ── fsharp ────────────────────────────────────────────────────────────────────── > let spaces1 = many1 whitespaceChar > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr " Hello" > let parser = spaces1 .>>. pstring "Hello" > runOnInput parser input |> _assertEqual ( > Success ( > ([[ ' '; ' ' ]], "Hello"), > { > lines = [[| " Hello" |]] > position = { line = 0; column = 7 } > } > ) > ) > > ── [ 36.43ms - stdout ] ──────────────────────────────────────────────────────── > │ Success (([' '; ' '], "Hello"), { lines = [|" Hello"|] > │ position = { line = 0 > │ column = 7 } > }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let digitChar = > satisfy Char.IsDigit "digit" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let input = fromStr "Hello" > let parser = digitChar > runOnInput parser input |> _assertEqual ( > Failure ( > "digit", > "Unexpected 'H'", > { > currentLine = "Hello" > line = 0 > column = 0 > } > ) > ) > > ── [ 15.44ms - stdout ] ──────────────────────────────────────────────────────── > │ Failure ("digit", "Unexpected 'H'", { currentLine = "Hello" > │ line = 0 > │ column = 0 }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let pint = > let inline resultToInt (sign, digits) = > let i = int digits > match sign with > | Some ch -> -i > | None -> i > > let digits = manyChars1 digitChar > > opt (pchar '-') .>>. digits > |> mapP resultToInt > <?> "integer" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run pint "-123" > |> _assertEqual ( > Success ( > -123, > { > lines = [[| "-123" |]] > position = { line = 0; column = 4 } > } > ) > ) > > ── [ 19.85ms - stdout ] ──────────────────────────────────────────────────────── > │ Success (-123, { lines = [|"-123"|] > │ position = { line = 0 > │ column = 4 } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let pfloat = > let inline resultToFloat (((sign, digits1), point), digits2) = > let fl = float $"{digits1}.{digits2}" > match sign with > | Some ch -> -fl > | None -> fl > > let digits = manyChars1 digitChar > > opt (pchar '-') .>>. digits .>>. pchar '.' .>>. digits > |> mapP resultToFloat > <?> "float" > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > run pfloat "-123.45" > |> _assertEqual ( > Success ( > -123.45, > { > lines = [[| "-123.45" |]] > position = { line = 0; column = 7 } > } > ) > ) > > ── [ 24.73ms - stdout ] ──────────────────────────────────────────────────────── > │ Success (-123.45, { lines = [|"-123.45"|] > │ position = { line = 0 > │ column = 7 } }) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline createParserForwardedToRef<'a> () = > let mutable parserRef : Parser<'a> = > { > label = "unknown" > parseFn = fun _ -> failwith "unfixed forwarded parser" > } > > let wrapperParser = > { parserRef with > parseFn = fun input -> runOnInput parserRef input > } > > wrapperParser, (fun v -> parserRef <- v) > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline (>>%) p x = > p > |>> fun _ -> x 00:00:17 v #3 runtime.execute_with_options / result / { file_name = dotnet; exit_code = 0; std_trace_length = 33523 } 00:00:17 d #4 runtime.execute_with_options / { file_name = jupyter; arguments = ["nbconvert", "/home/runner/work/polyglot/polyglot/apps/parser/Parser.dib.ipynb", "--to", "html", "--HTMLExporter.theme=dark"]; options = { command = jupyter nbconvert "/home/runner/work/polyglot/polyglot/apps/parser/Parser.dib.ipynb" --to html --HTMLExporter.theme=dark; cancellation_token = None; environment_variables = Array(MutCell([])); on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:00:17 v #5 ! [NbConvertApp] Converting notebook /home/runner/work/polyglot/polyglot/apps/parser/Parser.dib.ipynb to html 00:00:17 v #6 ! /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/nbformat/__init__.py:96: MissingIDFieldWarning: Cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future. 00:00:17 v #7 ! validate(nb) 00:00:18 v #8 ! /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/nbconvert/filters/highlight.py:71: UserWarning: IPython3 lexer unavailable, falling back on Python 3 00:00:18 v #9 ! return _pygments_highlight( 00:00:18 v #10 ! [NbConvertApp] Writing 413727 bytes to /home/runner/work/polyglot/polyglot/apps/parser/Parser.dib.html 00:00:18 v #11 runtime.execute_with_options / result / { file_name = jupyter; exit_code = 0; std_trace_length = 900 } 00:00:18 d #12 spiral.process_dib / dib / jupyter nbconvert / { exit_code = 0; jupyter_result_length = 900 } 00:00:18 d #13 runtime.execute_with_options / { file_name = pwsh; arguments = ["-c", "$counter = 1; $path = '/home/runner/work/polyglot/polyglot/apps/parser/Parser.dib.html'; (Get-Content $path -Raw) -replace '(id=\\\"cell-id=)[a-fA-F0-9]{8}', { $_.Groups[1].Value + $counter++ } | Set-Content $path"]; options = { command = pwsh -c "$counter = 1; $path = '/home/runner/work/polyglot/polyglot/apps/parser/Parser.dib.html'; (Get-Content $path -Raw) -replace '(id=\"cell-id=)[a-fA-F0-9]{8}', { $_.Groups[1].Value + $counter++ } | Set-Content $path"; cancellation_token = None; environment_variables = Array(MutCell([])); on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:00:19 v #14 runtime.execute_with_options / result / { file_name = pwsh; exit_code = 0; std_trace_length = 0 } 00:00:19 d #15 spiral.run / dib / html cell ids / { exit_code = 0; pwsh_replace_html_result_length = 0 } 00:00:19 d #16 spiral.process_dib / dib / { exit_code = 0; result_length = 34482 } 00:00:00 d #1 writeDibCode / output: Fs / path: Parser.dib 00:00:00 d #1 writeDibCode / output: Fs / path: JsonParser.dib 00:00:00 d #2 parseDibCode / output: Fs / file: Parser.dib 00:00:00 d #3 parseDibCode / output: Fs / file: JsonParser.dib polyglot/apps/parser/build.ps1 / $env:CI:'true'
In [ ]:
{ pwsh ../apps/spiral/build.ps1 } | Invoke-Block
00:00:00 d #1 writeDibCode / output: Fs / path: spiral_compiler.dib 00:00:00 d #2 parseDibCode / output: Fs / file: spiral_compiler.dib 00:00:00 d #1 persistCodeProject / packages: [Fable.Core; FSharp.Control.AsyncSeq; FSharpx.Collections; ... ] / modules: [deps/spiral/lib/spiral/common.fsx; deps/spiral/lib/spiral/sm.fsx; deps/spiral/lib/spiral/crypto.fsx; ... ] / name: spiral_compiler / hash: / code.Length: 826877 00:00:00 d #2 buildProject / fullPath: /home/runner/work/polyglot/polyglot/target/Builder/spiral_compiler/spiral_compiler.fsproj 00:00:00 d #1 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 "publish "/home/runner/work/polyglot/polyglot/target/Builder/spiral_compiler/spiral_compiler.fsproj" --configuration Release --output "/home/runner/work/polyglot/spiral/apps/compiler/dist" --runtime linux-x64"; options = { command = dotnet publish "/home/runner/work/polyglot/polyglot/target/Builder/spiral_compiler/spiral_compiler.fsproj" --configuration Release --output "/home/runner/work/polyglot/spiral/apps/compiler/dist" --runtime linux-x64; cancellation_token = None; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot/target/Builder/spiral_compiler"; stderr = true } } 00:00:00 v #2 > Determining projects to restore... 00:00:01 v #3 > Paket version 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 00:00:01 v #4 > The last full restore is still up to date. Nothing left to do. 00:00:01 v #5 > Total time taken: 0 milliseconds 00:00:01 v #6 > Paket version 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 00:00:01 v #7 > Restoring /home/runner/work/polyglot/polyglot/target/Builder/spiral_compiler/spiral_compiler.fsproj 00:00:01 v #8 > Starting restore process. 00:00:01 v #9 > Total time taken: 0 milliseconds 00:00:02 v #10 > Restored /home/runner/work/polyglot/polyglot/target/Builder/spiral_compiler/spiral_compiler.fsproj (in 293 ms). 00:00:31 v #11 > spiral_compiler -> /home/runner/work/polyglot/polyglot/target/Builder/spiral_compiler/bin/Release/net9.0/linux-x64/spiral_compiler.dll 00:00:32 v #12 > spiral_compiler -> /home/runner/work/polyglot/spiral/apps/compiler/dist 00:00:32 d #13 runtime.execute_with_options_async / { exit_code = 0; output_length = 753; options = { command = dotnet publish "/home/runner/work/polyglot/polyglot/target/Builder/spiral_compiler/spiral_compiler.fsproj" --configuration Release --output "/home/runner/work/polyglot/spiral/apps/compiler/dist" --runtime linux-x64; cancellation_token = None; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot/target/Builder/spiral_compiler"; stderr = true } } spiral/lib/spiral/lib.ps1/GetTargetDir / targetDir: /home/runner/work/polyglot/polyglot/target/Builder/spiral_compiler spiral/apps/compiler/build.ps1 / $targetDir = /home/runner/work/polyglot/polyglot/target/Builder/spiral_compiler / $projectName: spiral_compiler / $env:CI:'true' 00:00:00 d #1 spiral.main / { args = Array(MutCell(["dib", "--path", "Supervisor.dib", "--retries", "3"])) } 00:00:00 d #2 runtime.execute_with_options / { file_name = dotnet; arguments = ["repl", "--exit-after-run", "--run", "/home/runner/work/polyglot/polyglot/apps/spiral/Supervisor.dib", "--output-path", "/home/runner/work/polyglot/polyglot/apps/spiral/Supervisor.dib.ipynb"]; options = { command = dotnet repl --exit-after-run --run "/home/runner/work/polyglot/polyglot/apps/spiral/Supervisor.dib" --output-path "/home/runner/work/polyglot/polyglot/apps/spiral/Supervisor.dib.ipynb"; cancellation_token = None; environment_variables = Array(MutCell([("TRACE_LEVEL", "Verbose"), ("AUTOMATION", "True")])); on_line = None; stdin = None; trace = false; working_directory = None; stderr = true } } > > ── fsharp ────────────────────────────────────────────────────────────────────── > #nowarn 0686 > > ── markdown ──────────────────────────────────────────────────────────────────── > │ # Supervisor (Polyglot) > > ── fsharp ────────────────────────────────────────────────────────────────────── > #r > @"../../../../../../../.nuget/packages/fsharp.control.asyncseq/3.2.1/lib/netstan > dard2.1/FSharp.Control.AsyncSeq.dll" > #r > @"../../../../../../../.nuget/packages/system.reactive/6.0.1-preview.1/lib/net6. > 0/System.Reactive.dll" > #r > @"../../../../../../../.nuget/packages/system.reactive.linq/6.0.1-preview.1/lib/ > netstandard2.0/System.Reactive.Linq.dll" > #r > @"../../../../../../../.nuget/packages/argu/6.2.4/lib/netstandard2.0/Argu.dll" > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.http.connections.com > mon/7.0.0/lib/net7.0/Microsoft.AspNetCore.Http.Connections.Common.dll" > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.http.connections.cli > ent/7.0.0/lib/net7.0/Microsoft.AspNetCore.Http.Connections.Client.dll" > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.signalr.common/7.0.0 > /lib/net7.0/Microsoft.AspNetCore.SignalR.Common.dll" > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.signalr.client/7.0.0 > /lib/net7.0/Microsoft.AspNetCore.SignalR.Client.dll" > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.signalr.client.core/ > 7.0.0/lib/net7.0/Microsoft.AspNetCore.SignalR.Client.Core.dll" > #r > @"../../../../../../../.nuget/packages/fsharp.json/0.4.1/lib/netstandard2.0/FSha > rp.Json.dll" > > ── fsharp ────────────────────────────────────────────────────────────────────── > #if !INTERACTIVE > open Lib > #endif > > ── fsharp ────────────────────────────────────────────────────────────────────── > open Common > open SpiralFileSystem.Operators > open Microsoft.AspNetCore.SignalR.Client > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### sendJson > > ── fsharp ────────────────────────────────────────────────────────────────────── > let sendJson (port : int) (json : string) = async { > let host = "127.0.0.1" > let! portOpen = SpiralNetworking.test_port_open host port > if portOpen then > try > let connection = > HubConnectionBuilder().WithUrl($"http://{host}:{port}").Build() > do! connection.StartAsync () |> Async.AwaitTask > let! result = connection.InvokeAsync<string> ("ClientToServerMsg", > json) |> Async.AwaitTask > do! connection.StopAsync () |> Async.AwaitTask > trace Verbose (fun () -> $"Supervisor.sendJson / port: {port} / > json: {json |> SpiralSm.ellipsis_end 200} / result: {result |> Option.ofObj |> > Option.map (SpiralSm.ellipsis_end 200)}") _locals > return Some result > with ex -> > trace Critical (fun () -> $"Supervisor.sendJson / port: {port} / > json: {json |> SpiralSm.ellipsis_end 200} / ex: {ex |> > SpiralSm.format_exception}") _locals > return None > else > trace Debug (fun () -> $"Supervisor.sendJson / port: {port} / error: > port not open") _locals > return None > } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### sendObj > > ── fsharp ────────────────────────────────────────────────────────────────────── > let sendObj port obj = > obj > |> System.Text.Json.JsonSerializer.Serialize > |> sendJson port > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### workspaceRoot > > ── fsharp ────────────────────────────────────────────────────────────────────── > let workspaceRoot = SpiralFileSystem.get_workspace_root () > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### getFilePathFromUri > > ── fsharp ────────────────────────────────────────────────────────────────────── > let getFilePathFromUri uri = > match System.Uri.TryCreate (uri, System.UriKind.Absolute) with > | true, uri -> uri.AbsolutePath |> System.IO.Path.GetFullPath > | _ -> failwith "invalid uri" > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### getCompilerPort > > ── fsharp ────────────────────────────────────────────────────────────────────── > let getCompilerPort () = > 13805 > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### serialize_obj > > ── fsharp ────────────────────────────────────────────────────────────────────── > let serializeObj obj = > try > obj > |> FSharp.Json.Json.serialize > |> SpiralSm.replace "\\\\" "\\" > |> SpiralSm.replace "\\r\\n" "\n" > |> SpiralSm.replace "\\n" "\n" > with ex -> > trace Critical (fun () -> "Supervisor.serialize_obj / obj: %A{obj}") > _locals > "" > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### Backend > > ── fsharp ────────────────────────────────────────────────────────────────────── > type Backend = > | Gleam > | Fsharp > | Python > | Cpp > > ── fsharp ────────────────────────────────────────────────────────────────────── > #r > @"../../../../../../../.nuget/packages/fsharpx.collections/3.1.0/lib/netstandard > 2.0/FSharpx.Collections.dll" > #r > @"../../../../../../../.nuget/packages/hopac/0.5.1/lib/netstandard2.0/Hopac.dll" > #r > @"../../../../../../../.nuget/packages/hopac/0.5.1/lib/netstandard2.0/Hopac.Core > .dll" > #r > @"../../../../../../../.nuget/packages/fparsec/2.0.0-beta2/lib/netstandard2.1/FP > arsec.dll" > #r > @"../../../../../../../.nuget/packages/fparsec/2.0.0-beta2/lib/netstandard2.1/FP > arsecCS.dll" > > > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.dll" > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.dll" > #endif > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.SignalR.dll" > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.SignalR.dll" > #endif > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.SignalR.Core.dll" > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.SignalR.Core.dll" > #endif > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.Cors.dll" > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.Cors.dll" > #endif > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.Http.Abstractions.dll > " > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.Http.Abstractions.dll" > #endif > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.Connections.Abstracti > ons.dll" > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.Connections.Abstractions. > dll" > #endif > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.Hosting.Abstractions. > dll" > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.Hosting.Abstractions.dll" > #endif > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.Http.Connections.dll" > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.Http.Connections.dll" > #endif > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.Routing.dll" > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.Routing.dll" > #endif > > ── pwsh ──────────────────────────────────────────────────────────────────────── > ls ~/.nuget/packages/microsoft.extensions.logging > echo "`n" > ls ~/.nuget/packages/microsoft.extensions.logging.abstractions > > ── [ 372.77ms - stdout ] ─────────────────────────────────────────────────────── > │ 2.1.1 > │ 6.0.0 > │ 8.0.1 > │ 9.0.0-preview.1.24080.9 > │ 9.0.10 > │ 9.0.5 > │ > │ > │ 6.0.0 > │ 8.0.1 > │ 8.0.2 > │ 9.0.0-preview.1.24080.9 > │ 9.0.10 > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > #r > @"../../../../../../../.nuget/packages/microsoft.extensions.logging/9.0.5/lib/ne > t9.0/Microsoft.Extensions.Logging.dll" > #r > @"../../../../../../../.nuget/packages/microsoft.extensions.logging.abstractions > /9.0.10/lib/net9.0/Microsoft.Extensions.Logging.Abstractions.dll" > #r > @"../../../../../../../.nuget/packages/microsoft.extensions.dependencyinjection. > abstractions/9.0.5/lib/net9.0/Microsoft.Extensions.DependencyInjection.Abstracti > ons.dll" > > ── pwsh ──────────────────────────────────────────────────────────────────────── > ls ~/.nuget/packages/system.management > > ── [ 12.83ms - stdout ] ──────────────────────────────────────────────────────── > │ 7.0.0 > │ 9.0.0-preview.1.24080.9 > │ 9.0.10 > │ 9.0.4 > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > #r > @"../../../../../../../.nuget/packages/system.management/9.0.4/lib/netstandard2. > 0/System.Management.dll" > > ── fsharp ────────────────────────────────────────────────────────────────────── > open spiral_compiler > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### awaitCompiler > > ── fsharp ────────────────────────────────────────────────────────────────────── > let awaitCompiler port cancellationToken = async { > let host = "127.0.0.1" > let struct (ct, disposable) = cancellationToken |> > SpiralThreading.new_disposable_token > let! ct = ct |> SpiralAsync.merge_cancellation_token_with_default_async > > let compiler = MailboxProcessor.Start (fun inbox -> async { > let! availablePort = SpiralNetworking.get_available_port (Some 180) host > port > if availablePort <> port then > inbox.Post (port, false) > else > let compilerDir = > workspaceRoot </> "deps/spiral/apps/compiler/dist" > |> System.IO.Path.GetFullPath > > let compilerPath = compilerDir </> > $"spiral_compiler{SpiralPlatform.get_executable_suffix ()}" > > let! exitCode, result = > SpiralRuntime.execution_options (fun x -> > { x with > l0 = $"\"{compilerPath}\" --port {availablePort} > --default-int i32 --default-float f64" > l1 = Some ct > l3 = Some (fun struct (_, line, _) -> async { > if line |> SpiralSm.contains > $"System.IO.IOException: Failed to bind to address http://{host}:{port}: address > already in use." then > inbox.Post (port, false) > > if line |> SpiralSm.contains $"Server bound to: > http://localhost:{availablePort}" then > let rec 루프 retry = async { > do! > SpiralNetworking.wait_for_port_access > (Some 100) true host availablePort > |> Async.runWithTimeoutAsync 500 > |> Async.Ignore > > let _locals () = $"port: {availablePort} / > retry: {retry} / {_locals ()}" > try > let pingObj = {| Ping = true |} > let! pingResult = pingObj |> sendObj > availablePort > trace Verbose (fun () -> > $"Supervisor.awaitCompiler / Ping / result: '%A{pingResult}'") _locals > > match pingResult with > | Some _ -> inbox.Post (availablePort, > true) > | None -> do! 루프 (retry + 1) > with ex -> > trace Verbose (fun () -> > $"Supervisor.awaitCompiler / Ping / ex: {ex |> SpiralSm.format_exception}") > _locals > do! 루프 (retry + 1) > } > do! 루프 1 > }) > l6 = Some workspaceRoot > } > ) > |> SpiralRuntime.execute_with_options_async > > trace Debug (fun () -> $"Supervisor.awaitCompiler / exitCode: > {exitCode} / result: {result}") _locals > disposable.Dispose () > }, ct) > > let! serverPort, managed = compiler.Receive () > > let connection = > HubConnectionBuilder().WithUrl($"http://{host}:{serverPort}").Build () > do! connection.StartAsync () |> Async.AwaitTask > > let event = Event<_> () > let disposable' = connection.On<string> ("ServerToClientMsg", event.Trigger) > let stream = > FSharp.Control.AsyncSeq.unfoldAsync > (fun () -> async { > let! msg = event.Publish |> Async.AwaitEvent > return Some (msg |> > FSharp.Json.Json.deserialize<ClientErrorsRes>, ()) > }) > () > > let disposable' = > new_disposable (fun () -> > async { > disposable'.Dispose () > do! connection.StopAsync () |> Async.AwaitTask > disposable.Dispose () > if managed > then do! > SpiralNetworking.wait_for_port_access (Some 100) false host > serverPort > |> Async.runWithTimeoutAsync 1500 > |> Async.Ignore > } > |> Async.RunSynchronously > ) > > return > serverPort, > stream, > ct, > disposable' > } > > ── fsharp ────────────────────────────────────────────────────────────────────── > open Hopac > open Hopac.Infixes > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### server > > ── fsharp ────────────────────────────────────────────────────────────────────── > let server1 = new_server<Job<unit>, obj, string option, Job<unit>, unit> () > let server2 = new_server<Job<unit>, obj, int array, Job<unit>, unit> () > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### buildFile > > ── fsharp ────────────────────────────────────────────────────────────────────── > let buildFile backend timeout port cancellationToken path = > let rec 루프 retry = async { > let fullPath = path |> System.IO.Path.GetFullPath |> > SpiralFileSystem.normalize_path > let fileDir = fullPath |> System.IO.Path.GetDirectoryName > let fileName = fullPath |> System.IO.Path.GetFileNameWithoutExtension > let! code = fullPath |> SpiralFileSystem.read_all_text_async > > // let stream, disposable = fileDir |> FileSystem.watchDirectory (fun _ > -> true) > // use _ = disposable > > let struct (token, disposable) = SpiralThreading.new_disposable_token > cancellationToken > use _ = disposable > > let outputFileName = > match backend with > | Gleam -> $"{fileName}.gleam" > | Fsharp -> $"{fileName}.fsx" > | Python -> $"{fileName}.py" > | Cpp -> $"{fileName}.cpp" > > // let outputContentSeq = > // stream > // |> FSharp.Control.AsyncSeq.chooseAsync (function > // | _, (FileSystem.FileSystemChange.Changed (path, Some text)) > // when (path |> System.IO.Path.GetFileName) = > outputFileName > // -> > // // fileDir </> path |> > SpiralFileSystem.read_all_text_retry_async > // text |> Some |> Async.init > // | _ -> None |> Async.init > // ) > // |> FSharp.Control.AsyncSeq.map (fun content -> > // Some (content |> SpiralSm.replace "\r\n" "\n"), None > // ) > > let printErrorData (data : {| uri : string; errors : RString list |}) = > let fileName = data.uri |> System.IO.Path.GetFileName > let errors = > data.errors > |> List.map snd > |> SpiralSm.concat "\n" > $"{fileName}:\n{errors}" > > > let port = port |> Option.defaultWith getCompilerPort > // let! serverPort, errors, ct, disposable = awaitCompiler port (Some > token) > let serverPort = port > // use _ = disposable > > let errorsSeq = > server1.errors > |> FSharp.Control.AsyncSeq.choose (fun error -> > match error with > | FatalError message -> > Some (message, error) > | TracedError data -> > Some (data.message, error) > | PackageErrors data when data.errors |> List.isEmpty |> not -> > Some (data |> printErrorData, error) > | TokenizerErrors data when data.errors |> List.isEmpty |> not > -> > Some (data |> printErrorData, error) > | ParserErrors data when data.errors |> List.isEmpty |> not -> > Some (data |> printErrorData, error) > | TypeErrors data when data.errors |> List.isEmpty |> not -> > Some (data |> printErrorData, error) > | _ -> None > ) > |> FSharp.Control.AsyncSeq.map (fun (message, error) -> > None, Some (message, error) > ) > > let timerSeq = > 500 > |> FSharp.Control.AsyncSeq.intervalMs > |> FSharp.Control.AsyncSeq.map (fun _ -> None, None) > > let compilerEvent = Event<option<string> * option<string * > ClientErrorsRes>> () > // let disposable' = connection.On<string> ("ServerToClientMsg", > event.Trigger) > let outputContentSeq = > FSharp.Control.AsyncSeq.unfoldAsync > (fun () -> async { > let! msg = compilerEvent.Publish |> Async.AwaitEvent > trace Verbose (fun () -> $"Supervisor.buildFile / > outputContentSeq unfoldAsync / msg: %A{msg}") _locals > return Some (msg, ()) > }) > () > > let compilerEvent2 = Event<option<string> * (string * ClientErrorsRes) > list * int> () > // let disposable' = connection.On<string> ("ServerToClientMsg", > event.Trigger) > let outputContentSeq2 = > FSharp.Control.AsyncSeq.unfoldAsync > (fun () -> async { > let! msg = compilerEvent2.Publish |> Async.AwaitEvent > trace Verbose (fun () -> $"Supervisor.buildFile / > outputContentSeq2 unfoldAsync / msg: %A{msg}") _locals > return Some (msg, ()) > }) > () > > let outputSeq = > [[ outputContentSeq; errorsSeq; timerSeq ]] > // [[ errorsSeq; timerSeq ]] > |> FSharp.Control.AsyncSeq.mergeAll > > let! outputChild = > ((None, [[]], 0), outputSeq) > ||> FSharp.Control.AsyncSeq.scan ( > fun (outputContentResult, errors, typeErrorCount) > (outputContent, error) -> > trace Verbose (fun () -> $"Supervisor.buildFile / > AsyncSeq.scan / outputContent:\n'{outputContent |> Option.map > (SpiralSm.ellipsis_end 1500)} / errors: {errors |> serializeObj} / > outputContentResult: {outputContentResult} / typeErrorCount: {typeErrorCount} / > retry: {retry} / error: {error} / path: {path}'") _locals > match outputContent, error with > | Some outputContent, None -> Some outputContent, errors, > typeErrorCount > | None, Some ( > _, > FatalError "File main has a type error somewhere in its > path." > ) -> > outputContentResult, errors, typeErrorCount + 1 > | None, Some error -> outputContentResult, error :: errors, > typeErrorCount > | None, None when typeErrorCount >= 1 -> > outputContentResult, errors, typeErrorCount + 1 > | _ -> outputContentResult, errors, typeErrorCount > ) > |> FSharp.Control.AsyncSeq.takeWhileInclusive (fun (outputContent, > errors, typeErrorCount) -> > trace > Verbose > (fun () -> $"Supervisor.buildFile / takeWhileInclusive / > outputContent:\n'{outputContent |> Option.map (SpiralSm.ellipsis_end 1500)}' / > errors: {errors |> serializeObj} / typeErrorCount: {typeErrorCount} / retry: > {retry} / path: {path}") > _locals > #if INTERACTIVE > let errorWait = 1 > #else > let errorWait = 1 > #endif > match outputContent, errors with > | None, [[]] when typeErrorCount > errorWait -> false > | _, [[ message, TypeErrors errors ]] -> > compilerEvent.Trigger (None, Some (message, TypeErrors > errors)) > trace Verbose (fun () -> $"Supervisor.buildFile / > takeWhileInclusive / TypeErrors trigger") _locals > false > | None, [[]] -> true > | _ -> false > ) > |> FSharp.Control.AsyncSeq.tryLast > // |> Async.withCancellationToken ct > |> Async.catch > |> Async.runWithTimeoutAsync timeout > |> Async.StartChild > > // do! Async.Sleep 60 > > let fullPathUri = fullPath |> SpiralFileSystem.normalize_path |> > SpiralFileSystem.new_file_uri > > trace Verbose (fun () -> $"Supervisor.buildFile / fullPathUri: > %A{fullPathUri}") (fun () -> "") > > // let fileOpenObj = {| FileOpen = {| uri = fullPathUri; spiText = code > |} |} > > // let! _fileOpenResult = fileOpenObj |> sendObj serverPort > let fileOpenArgs = {| uri = fullPathUri; spiText = code |} > let! _fileOpenResult = > server1.job_null (server1.supervisor *<+ SupervisorReq.FileOpen > fileOpenArgs) > |> Async.AwaitTask > |> Async.runWithTimeoutAsync 60000 > |> Async.map Option.get > trace Verbose (fun () -> $"Supervisor.buildFile / _fileOpenResult: > %A{_fileOpenResult}") (fun () -> "") > > // let! _fileOpenResult = fileOpenObj |> sendObj serverPort > > // do! Async.Sleep 60 > > let backendId = > match backend with > | Gleam -> "Gleam" > | Fsharp -> "Fsharp" > | Python -> "Python + Cuda" > | Cpp -> "Cpp + Cuda" > // let buildFileObj = {| BuildFile = {| uri = fullPathUri; backend = > backendId |} |} > > // let backend = Supervisor.Fsharp > let buildFileArgs = {| uri = fullPathUri; backend = backendId |} > let buildFileResultAsync = > server1.job_val (fun res -> server1.supervisor *<+ > SupervisorReq.BuildFile(buildFileArgs,res)) > |> Async.AwaitTask > |> Async.runWithTimeoutAsync timeout > |> Async.map Option.get > > let buildFileResultAsync = async { > let! buildFileResult = buildFileResultAsync > let buildFileResult = > if buildFileResult = "" || buildFileResult = null > then None > else buildFileResult |> SpiralSm.replace "\r\n" "\n" |> Some > trace Verbose (fun () -> $"Supervisor.buildFile / buildFileResult: > %A{buildFileResult}") (fun () -> "") > if buildFileResult.IsSome then > compilerEvent2.Trigger (buildFileResult, [[]], 0) > return buildFileResult, [[]], 0 > } > > let resultAsync = > outputChild > |> Async.map (fun x -> > trace Verbose (fun () -> $"Supervisor.buildFile / outputChild / > x: %A{x}") _locals > match x with > | Some (Ok (Some (outputCode, errors, typeErrorCount))) -> > let x = > match errors with > | [[ message, TypeErrors errors ]] -> > trace Verbose (fun () -> $"Supervisor.buildFile / > outputChild |> Async.map") _locals > compilerEvent2.Trigger (None, [[ message, TypeErrors > errors ]], 0) > trace Verbose (fun () -> $"Supervisor.buildFile / > outputChild |> Async.map") _locals > | _ -> () > outputCode, errors |> List.distinct |> List.rev, > typeErrorCount > | Some (Error ex) -> > trace Critical (fun () -> $"Supervisor.buildFile / error: > {ex |> SpiralSm.format_exception} / retry: {retry}") _locals > None, [[]], 0 > | _ -> None, [[]], 0 > ) > > trace Verbose (fun () -> $"Supervisor.buildFile / before result: > %A{()}") (fun () -> "") > > // let resultSeq = > // [[| buildFileResultAsync; resultAsync |]] > // |> FSharp.Control.AsyncSeq.ofSeqAsync > > > let buildFileResultSeq = [[| buildFileResultAsync |]] |> > FSharp.Control.AsyncSeq.ofSeqAsync > let resultSeq = [[| resultAsync |]] |> > FSharp.Control.AsyncSeq.ofSeqAsync > > let resultSeq = > [[ outputContentSeq2; buildFileResultSeq; resultSeq ]] > |> FSharp.Control.AsyncSeq.mergeAll > > let! buildFileResult, result, typeErrorCount = > resultSeq > // |> FSharp.Control.AsyncSeq.collect (Array.singleton >> > FSharp.Control.AsyncSeq.ofSeq) > |> FSharp.Control.AsyncSeq.collect (fun x -> > trace Verbose (fun () -> $"Supervisor.buildFile / ofSeqAsync / > x: %A{x}") _locals > match x with > | Some _, _, _ as x -> [[| x |]] > | _, _ :: _, _ as x -> [[| x |]] > | _ -> [[||]] > |> FSharp.Control.AsyncSeq.ofSeq > ) > |> FSharp.Control.AsyncSeq.tryFirst > |> Async.map Option.get > > trace Verbose (fun () -> $"Supervisor.buildFile / result: %A{result} / > buildFileResult: %A{buildFileResult} / typeErrorCount: {typeErrorCount}") (fun > () -> "") > > match buildFileResult with > // | None when typeErrorCount > 0 && retry = 0 -> > // trace Verbose (fun () -> $"Supervisor.buildFile / result: > {result} / retry: {retry} / typeErrorCount: {typeErrorCount} / fileDir: > {fileDir} / targetDir: {targetDir}") _locals > // return! 루프 (retry + 1) > | _ -> > let targetDir = workspaceRoot </> "target" > trace Verbose (fun () -> $"Supervisor.buildFile / retry: {retry} / > typeErrorCount: {typeErrorCount} / fileDir: {fileDir} / targetDir: {targetDir}") > _locals > if fileDir |> SpiralSm.starts_with targetDir then > let fileDirUri = fileDir |> SpiralFileSystem.normalize_path |> > SpiralFileSystem.new_file_uri > > // let fileDeleteObj = {| FileDelete = {| uris = [[| fileDirUri > |]] |} |} > // let! _fileDeleteResult = fileDeleteObj |> sendObj serverPort > let fileDeleteArgs = {| uris = [[| fileDirUri |]] |} > let! _fileDeleteResult = > server1.job_null (server1.supervisor *<+ > SupervisorReq.FileDelete fileDeleteArgs) > |> Async.AwaitTask > () > > let outputPath = fileDir </> outputFileName > return outputPath, buildFileResult, result > } > 루프 0 > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### SpiralInput > > ── fsharp ────────────────────────────────────────────────────────────────────── > type SpiralInput = > | Spi of string * string option > | Spir of string > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### persistCode > > ── fsharp ────────────────────────────────────────────────────────────────────── > let persistCode (input: {| backend : Backend option; input: SpiralInput; > packages: string [[]] |}) = async { > let targetDir = workspaceRoot </> "target/spiral_Eval" > > let packagesDir = targetDir </> "packages" > > let hashHex = $"%A{input.backend}%A{input.input}" |> SpiralCrypto.hash_text > > let packageDir = packagesDir </> hashHex > > let packageDir = > if input.backend = Some Gleam > then packageDir </> "src" > else packageDir > > packageDir |> System.IO.Directory.CreateDirectory |> ignore > > let moduleName = "main" > > let spirModule, spiModule = > match input.input with > | Spi (_spi, Some _spir) -> true, true > | Spi (_spi, None) -> false, true > | Spir _spir -> true, false > |> fun (spir, spi) -> > (if spir then $"{moduleName}_real*-" else ""), > if spi then moduleName else "" > > let libLinkTargetPath = workspaceRoot </> "../spiral/lib/spiral" > let libLinkPath = packageDir </> "spiral" > > let packagesModule = > input.packages > |> Array.map (fun package -> > let path = workspaceRoot </> package > let packageName = path |> System.IO.Path.GetFileName > let libLinkPath = packageDir </> packageName > libLinkPath |> SpiralFileSystem.link_directory path > $"{packageName}-" > ) > |> String.concat "\n " > > let packageDir' = > if input.packages |> Array.isEmpty > then workspaceRoot </> "../spiral/lib" > else > libLinkPath |> SpiralFileSystem.link_directory libLinkTargetPath > packageDir > > let spiprojPath = packageDir </> "package.spiproj" > let spiprojCode = > $"""packageDir: {packageDir'} > packages: > |core- > spiral- > {packagesModule} > modules: > {spirModule} > {spiModule} > """ > do! spiprojCode |> SpiralFileSystem.write_all_text_exists spiprojPath > > let spirPath = packageDir </> $"{moduleName}_real.spir" > let spiPath = packageDir </> $"{moduleName}.spi" > > let spirCode, spiCode = > match input.input with > | Spi (spi, Some spir) -> Some spir, Some spi > | Spi (spi, None) -> None, Some spi > | Spir spir -> Some spir, None > > match spirCode with > | Some spir -> do! spir |> SpiralFileSystem.write_all_text_exists spirPath > | None -> () > match spiCode with > | Some spi -> do! spi |> SpiralFileSystem.write_all_text_exists spiPath > | None -> () > > let spiralPath = > match input.input with > | Spi _ -> spiPath > | Spir _ -> spirPath > match input.backend with > | None -> return spiralPath, None > | Some backend -> > let outputFileName = > let fileName = > match input.input with > | Spi _ -> moduleName > | Spir _ -> $"{moduleName}_real" > match backend with > | Gleam -> $"{fileName}.gleam" > | Fsharp -> $"{fileName}.fsx" > | Python -> $"{fileName}.py" > | Cpp -> $"{fileName}.cpp" > let outputPath = packageDir </> outputFileName > if outputPath |> System.IO.File.Exists |> not > then return spiralPath, None > else > let! oldCode = spiralPath |> SpiralFileSystem.read_all_text_async > if oldCode <> (spiCode |> Option.defaultValue (spirCode |> > Option.defaultValue "")) > then return spiralPath, None > else > let! outputCode = outputPath |> > SpiralFileSystem.read_all_text_async > return spiralPath, Some (outputPath, outputCode |> > SpiralSm.replace "\r\n" "\n") > } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### buildCode > > ── fsharp ────────────────────────────────────────────────────────────────────── > let buildCode backend packages isCache timeout cancellationToken input = async { > let! mainPath, outputCache = > persistCode {| input = input; backend = Some backend; packages = > packages |} > match outputCache with > | Some (outputPath, outputCode) when isCache -> return mainPath, > (outputPath, Some outputCode), [[]] > | _ -> > let! outputPath, outputCode, errors = mainPath |> buildFile backend > timeout None cancellationToken > return mainPath, (outputPath, outputCode), errors > } > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > SpiralTrace.TraceLevel.US0_0 |> set_trace_level > """inl app () = > console.write_line "text" > 1i32 > > inl main () = > app > |> dyn > |> ignore > """ > |> fun code -> Spi (code, None) > |> buildCode Fsharp [[||]] false 20000 None > |> Async.runWithTimeout 21000 > |> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> > List.map fst) > |> _assertEqual ( > Some ( > Some """let rec closure1 () () : unit = > let v0 : (string -> unit) = System.Console.WriteLine > let v1 : string = "text" > v0 v1 > and closure0 () () : int32 = > let v3 : unit = () > let v4 : (unit -> unit) = closure1() > let v5 : unit = (fun () -> v4 (); v3) () > 1 > let v0 : (unit -> int32) = closure0() > () > """, > [[]] > ) > ) > > ── [ 2.60s - stdout ] ────────────────────────────────────────────────────────── > │ 00:00:58 v #1 Supervisor.buildFile / fullPathUri: > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd043 > 17d5605c65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi" > │ 00:00:58 v #2 Supervisor.buildFile / _fileOpenResult: > <null> > │ 00:00:58 v #3 Supervisor.buildFile / before result: () > │ 00:00:58 v #4 Supervisor.buildFile / takeWhileInclusive > / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c > 65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi > │ 00:00:58 v #7 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c > 65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi' > │ 00:00:58 v #8 Supervisor.buildFile / takeWhileInclusive > / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c > 65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi > │ 00:00:58 v #739 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c > 65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi' > │ 00:00:58 v #740 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c > 65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi > │ 00:00:59 v #1005 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c > 65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi' > │ 00:00:59 v #1006 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c > 65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi > │ 00:00:59 v #1142 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c > 65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi' > │ 00:00:59 v #1143 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c > 65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi > │ 00:01:00 v #1320 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c > 65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi' > │ 00:01:00 v #1321 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c > 65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6/main.spi > │ 00:01:00 v #1322 Supervisor.buildFile / buildFileResult: > Some > │ "let rec closure1 () () : unit = > │ let v0 : (string -> unit) = System.Console.WriteLine > │ let v1 : string = "text" > │ v0 v1 > │ and closure0 () () : int32 = > │ let v3 : unit = () > │ let v4 : (unit -> unit) = closure1() > │ let v5 : unit = (fun () -> v4 (); v3) () > │ 1 > │ let v0 : (unit -> int32) = closure0() > │ () > │ " > │ 00:01:00 v #1323 Supervisor.buildFile / > outputContentSeq2 unfoldAsync / msg: (Some > │ "let rec closure1 () () : unit = > │ let v0 : (string -> unit) = System.Console.WriteLine > │ let v1 : string = "text" > │ v0 v1 > │ and closure0 () () : int32 = > │ let v3 : unit = () > │ let v4 : (unit -> unit) = closure1() > │ let v5 : unit = (fun () -> v4 (); v3) () > │ 1 > │ let v0 : (unit -> int32) = closure0() > │ () > │ ", > │ [], 0) > │ 00:01:00 v #1324 Supervisor.buildFile / ofSeqAsync / x: > (Some > │ "let rec closure1 () () : unit = > │ let v0 : (string -> unit) = System.Console.WriteLine > │ let v1 : string = "text" > │ v0 v1 > │ and closure0 () () : int32 = > │ let v3 : unit = () > │ let v4 : (unit -> unit) = closure1() > │ let v5 : unit = (fun () -> v4 (); v3) () > │ 1 > │ let v0 : (unit -> int32) = closure0() > │ () > │ ", > │ [], 0) > │ 00:01:00 v #1325 Supervisor.buildFile / result: [] / > buildFileResult: Some > │ "let rec closure1 () () : unit = > │ let v0 : (string -> unit) = System.Console.WriteLine > │ let v1 : string = "text" > │ v0 v1 > │ and closure0 () () : int32 = > │ let v3 : unit = () > │ let v4 : (unit -> unit) = closure1() > │ let v5 : unit = (fun () -> v4 (); v3) () > │ 1 > │ let v0 : (unit -> int32) = closure0() > │ () > │ " / typeErrorCount: 0 > │ 00:01:00 v #1326 Supervisor.buildFile / retry: 0 / > typeErrorCount: 0 / fileDir: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/22ccd04317d5605c > 65f81c7f777766f357e85dc69f2d6d04b9dc60aebd08a0d6 / targetDir: > /home/runner/work/polyglot/polyglot/target > │ Some > │ (Some > │ "let rec closure1 () () : unit = > │ let v0 : (string -> unit) = System.Console.WriteLine > │ let v1 : string = "text" > │ v0 v1 > │ and closure0 () () : int32 = > │ let v3 : unit = () > │ let v4 : (unit -> unit) = closure1() > │ let v5 : unit = (fun () -> v4 (); v3) () > │ 1 > │ let v0 : (unit -> int32) = closure0() > │ () > │ ", > │ []) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > """ > inl init_series start end inc = > inl total : f64 = conv ((end - start) / inc) + 1 > listm.init total (conv >> (*) inc >> (+) start) : list f64 > > type integration = (f64 -> f64) -> f64 -> f64 -> f64 > > inl integral dt : integration = > fun f a b => > init_series (a + dt / 2) (b - dt / 2) dt > |> listm.map (f >> (*) dt) > |> listm.fold (+) 0 > > inl main () = > integral 0.1 (fun x => x ** 2) 0 1 > """ > |> fun code -> Spi (code, None) > |> buildCode Fsharp [[||]] false 10000 None > |> Async.runWithTimeout 11000 > |> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> > List.map fst) > |> _assertEqual ( > Some ( > Some "0.3325000000000001\n", > [[]] > ) > ) > > ── [ 424.82ms - stdout ] ─────────────────────────────────────────────────────── > │ 00:01:00 v #1344 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d > 9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi > │ 00:01:00 v #1345 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d > 9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi' > │ 00:01:00 v #1346 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d > 9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi > │ 00:01:00 v #1347 Supervisor.buildFile / fullPathUri: > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414d > e2a2a92d9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db/main.spi" > │ 00:01:00 v #1348 Supervisor.buildFile / _fileOpenResult: > <null> > │ 00:01:00 v #1349 Supervisor.buildFile / before result: > () > │ 00:01:00 v #1587 Supervisor.buildFile / buildFileResult: > Some "0.3325000000000001 > │ " > │ 00:01:00 v #1588 Supervisor.buildFile / > outputContentSeq2 unfoldAsync / msg: (Some "0.3325000000000001 > │ ", [], 0) > │ 00:01:00 v #1589 Supervisor.buildFile / ofSeqAsync / x: > (Some "0.3325000000000001 > │ ", [], 0) > │ 00:01:00 v #1590 Supervisor.buildFile / result: [] / > buildFileResult: Some "0.3325000000000001 > │ " / typeErrorCount: 0 > │ 00:01:00 v #1591 Supervisor.buildFile / retry: 0 / > typeErrorCount: 0 / fileDir: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c127414de2a2a92d > 9fd93ea5a8e9312a6aad9129ffd3cbd56ac7f0327106f1db / targetDir: > /home/runner/work/polyglot/polyglot/target > │ Some (Some "0.3325000000000001 > │ ", []) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > """ > inl init_series start end inc = > inl total : f64 = conv ((end - start) / inc) + 1 > listm.init total (conv >> (*) inc >> (+) start) : list f64 > > type integration = (f64 -> f64) -> f64 -> f64 -> f64 > > inl integral dt : integration = > fun f a b => > init_series (a + dt / 2) (b - dt / 2) dt > |> listm.map (f >> (*) dt) > |> listm.fold (+) 0 > > inl main () = > integral 0.1 (fun x => x ** 2) 0 1 > """ > |> fun code -> Spi (code, None) > |> buildCode Python [[||]] false 10000 None > |> Async.runWithTimeout 11000 > |> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> > List.map fst) > |> _assertEqual ( > Some ( > Some @"kernels_aux = r"""""" > // The types of these two will be replaced during compilation by the Spiral code > generator. > // It matches on `using default_int = ` and `;` with the inner part being > replaced so the form should be kept as is. > // The two statements need to begin at the start of a line. > using default_int = int; > using default_uint = unsigned int; > > #ifndef __NVRTC__ > // NVRTC has these includes by default so they need to be left out if it is used > as the compiler. > #include <new> > #include <assert.h> > #include <stdio.h> > #endif > > // For error checking on the host. > #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); } > template <typename T> inline __device__ void destroy(T& obj) { obj.~T(); } > inline void gpuAssert(cudaError error, const char *file, int line, bool > abort=true) { > if (error != cudaSuccess) { > fprintf(stderr, ""GPUassert: %s %s %d\n"", cudaGetErrorString(error), > file, line); > if (abort) exit(error); > } > } > > template <typename el> > struct sptr // Shared pointer for the Spiral datatypes. They have to have the > refc field inside them to work. > { > el* base; > > __device__ sptr() : base(nullptr) {} > __device__ sptr(el* ptr) : base(ptr) { this->base->refc++; } > > __device__ ~sptr() > { > if (this->base != nullptr && --this->base->refc == 0) > { > delete this->base; > this->base = nullptr; > } > } > > __device__ sptr(sptr& x) > { > this->base = x.base; > this->base->refc++; > } > > __device__ sptr(sptr&& x) > { > this->base = x.base; > x.base = nullptr; > } > > __device__ sptr& operator=(sptr& x) > { > if (this->base != x.base) > { > delete this->base; > this->base = x.base; > this->base->refc++; > } > return *this; > } > > __device__ sptr& operator=(sptr&& x) > { > if (this->base != x.base) > { > delete this->base; > this->base = x.base; > x.base = nullptr; > } > return *this; > } > }; > > template <typename el> > struct csptr : public sptr<el> > { // Shared pointer for closures specifically. > using sptr<el>::sptr; > template <typename... Args> > __device__ auto operator()(Args... args) -> > decltype(this->base->operator()(args...)) > { > return this->base->operator()(args...); > } > }; > > template <typename el, default_int max_length> > struct static_array > { > el ptr[[max_length]]; > __device__ el& operator[[]](default_int i) { > assert(""The index has to be in range."" && 0 <= i && i < max_length); > return this->ptr[[i]]; > } > }; > > template <typename el, default_int max_length> > struct static_array_list > { > default_int length{ 0 }; > el ptr[[max_length]]; > > __device__ el& operator[[]](default_int i) { > assert(""The index has to be in range."" && 0 <= i && i < this->length); > return this->ptr[[i]]; > } > __device__ void push(el& x) { > ptr[[this->length++]] = x; > assert(""The array after pushing should not be greater than max > length."" && this->length <= max_length); > } > __device__ void push(el&& x) { > ptr[[this->length++]] = std::move(x); > assert(""The array after pushing should not be greater than max > length."" && this->length <= max_length); > } > __device__ el pop() { > assert(""The array before popping should be greater than 0."" && 0 < > this->length); > auto x = ptr[[--this->length]]; > ptr[[this->length]].~el(); > new (&ptr[[this->length]]) el(); > return x; > } > // Should be used only during initialization. > __device__ void unsafe_set_length(default_int i) { > assert(""The new length should be in range."" && 0 <= i && i <= > max_length); > this->length = i; > } > }; > > template <typename el, default_int max_length> > struct dynamic_array_base > { > int refc{ 0 }; > el* ptr; > > __device__ dynamic_array_base() : ptr(new el[[max_length]]) {} > __device__ ~dynamic_array_base() { delete[[]] this->ptr; } > > __device__ el& operator[[]](default_int i) { > assert(""The index has to be in range."" && 0 <= i && i < this->length); > return this->ptr[[i]]; > } > }; > > template <typename el, default_int max_length> > struct dynamic_array > { > sptr<dynamic_array_base<el, max_length>> ptr; > > __device__ dynamic_array() = default; > __device__ dynamic_array(bool t) : ptr(new dynamic_array_base<el, > max_length>()) {} > __device__ el& operator[[]](default_int i) { > return this->ptr.base->operator[[]](i); > } > }; > > template <typename el, default_int max_length> > struct dynamic_array_list_base > { > int refc{ 0 }; > default_int length{ 0 }; > el* ptr; > > __device__ dynamic_array_list_base() : ptr(new el[[max_length]]) {} > __device__ dynamic_array_list_base(default_int l) : ptr(new > el[[max_length]]) { this->unsafe_set_length(l); } > __device__ ~dynamic_array_list_base() { delete[[]] this->ptr; } > > __device__ el& operator[[]](default_int i) { > assert(""The index has to be in range."" && 0 <= i && i < this->length); > return this->ptr[[i]]; > } > __device__ void push(el& x) { > ptr[[this->length++]] = x; > assert(""The array after pushing should not be greater than max > length."" && this->length <= max_length); > } > __device__ void push(el&& x) { > ptr[[this->length++]] = std::move(x); > assert(""The array after pushing should not be greater than max > length."" && this->length <= max_length); > } > __device__ el pop() { > assert(""The array before popping should be greater than 0."" && 0 < > this->length); > auto x = ptr[[--this->length]]; > ptr[[this->length]].~el(); > new (&ptr[[this->length]]) el(); > return x; > } > // Should be used only during initialization. > __device__ void unsafe_set_length(default_int i) { > assert(""The new length should be in range."" && 0 <= i && i <= > max_length); > this->length = i; > } > }; > > template <typename el, default_int max_length> > struct dynamic_array_list > { > sptr<dynamic_array_list_base<el, max_length>> ptr; > > __device__ dynamic_array_list() = default; > __device__ dynamic_array_list(default_int l) : ptr(new > dynamic_array_list_base<el, max_length>(l)) {} > > __device__ el& operator[[]](default_int i) { > return this->ptr.base->operator[[]](i); > } > __device__ void push(el& x) { > this->ptr.base->push(x); > } > __device__ void push(el&& x) { > this->ptr.base->push(std::move(x)); > } > __device__ el pop() { > return this->ptr.base->pop(); > } > // Should be used only during initialization. > __device__ void unsafe_set_length(default_int i) { > this->ptr.base->unsafe_set_length(i); > } > __device__ default_int length_() { > return this->ptr.base->length; > } > }; > """""" > class static_array(): > def __init__(self, length): > self.ptr = [[]] > for _ in range(length): > self.ptr.append(None) > > def __getitem__(self, index): > assert 0 <= index < len(self.ptr), ""The get index needs to be in > range."" > return self.ptr[[index]] > > def __setitem__(self, index, value): > assert 0 <= index < len(self.ptr), ""The set index needs to be in > range."" > self.ptr[[index]] = value > > class static_array_list(static_array): > def __init__(self, length): > super().__init__(length) > self.length = 0 > > def __getitem__(self, index): > assert 0 <= index < self.length, ""The get index needs to be in range."" > return self.ptr[[index]] > > def __setitem__(self, index, value): > assert 0 <= index < self.length, ""The set index needs to be in range."" > self.ptr[[index]] = value > > def push(self,value): > assert (self.length < len(self.ptr)), ""The length before pushing has to > be less than the maximum length of the array."" > self.ptr[[self.length]] = value > self.length += 1 > > def pop(self): > assert (0 < self.length), ""The length before popping has to be greater > than 0."" > self.length -= 1 > return self.ptr[[self.length]] > > def unsafe_set_length(self,i): > assert 0 <= i <= len(self.ptr), ""The new length has to be in range."" > self.length = i > > class dynamic_array(static_array): > pass > > class dynamic_array_list(static_array_list): > def length_(self): return self.length > > > kernels_main = r"""""" > """""" > from main_auto import * > kernels = kernels_aux + kernels_main > import cupy as cp > import numpy as np > from dataclasses import dataclass > from typing import NamedTuple, Union, Callable, Tuple > i8 = int; i16 = int; i32 = int; i64 = int; u8 = int; u16 = int; u32 = int; u64 = > int; f32 = float; f64 = float; char = str; string = str > cuda = False > > > # fwd_dcls > # types > # functions > # main_defs > def main_body(): > return 0.3325000000000001 > > def main(): > r = main_body() > if cuda: cp.cuda.get_current_stream().synchronize() # This line is here so > the `__trap()` calls on the kernel aren't missed. > return r > > if __name__ == '__main__': result = main(); None if result is None else > print(result) > ", > [[]] > ) > ) > > ── [ 406.72ms - stdout ] ─────────────────────────────────────────────────────── > │ 00:01:01 v #1610 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a4224c9f3d674d70 > fd56b6ecd3ae8c8ff3178a7124ae34f592336fef263568ea/main.spi > │ 00:01:01 v #1611 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a4224c9f3d674d70 > fd56b6ecd3ae8c8ff3178a7124ae34f592336fef263568ea/main.spi' > │ 00:01:01 v #1612 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a4224c9f3d674d70 > fd56b6ecd3ae8c8ff3178a7124ae34f592336fef263568ea/main.spi > │ 00:01:01 v #1613 Supervisor.buildFile / fullPathUri: > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a4224c9f > 3d674d70fd56b6ecd3ae8c8ff3178a7124ae34f592336fef263568ea/main.spi" > │ 00:01:01 v #1614 Supervisor.buildFile / _fileOpenResult: > <null> > │ 00:01:01 v #1615 Supervisor.buildFile / before result: > () > │ 00:01:01 v #1855 Supervisor.buildFile / buildFileResult: > Some > │ "kernels_aux = r""" > │ // The types of these two will be replaced during compilation > by the Spiral code generator. > │ // It matches on `using default_int = ` and `;` with the > inner part being replaced so the form should be kept as is. > │ // The two statements need to begin at the start of a line. > │ using default_int = int; > │ using default_uint = unsigned int; > │ > │ #ifndef __NVRTC__ > │ // NVRTC has these includes by default so they need to be > left out if it is used as the compiler. > │ #include <new> > │ #include <assert.h> > │ #include <stdio.h> > │ #endif > │ > │ // For error checking on the host. > │ #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, > __LINE__); } > │ template <typename T> inline __device__ void destroy(T& obj) > { obj.~T(); } > │ inline void gpuAssert(cudaError error, const char *file, int > line, bool abort=true) { > │ if (error != cudaSuccess) { > │ fprintf(stderr, "GPUassert: %s %s %d\n", > cudaGetErrorString(error), file, line); > │ if (abort) exit(error); > │ } > │ } > │ > │ template <typename el> > │ struct sptr // Shared pointer for the Spiral datatypes. They > have to have the refc field inside them to work. > │ { > │ el* base; > │ > │ __device__ sptr() : base(nullptr) {} > │ __device__ sptr(el* ptr) : base(ptr) { > this->base->refc++; } > │ > │ __device__ ~sptr() > │ { > │ if (this->base != nullptr && --this->base->refc == 0) > │ { > │ delete this->base; > │ this->base = nullptr; > │ } > │ } > │ > │ __device__ sptr(sptr& x) > │ { > │ this->base = x.base; > │ this->base->refc++; > │ } > │ > │ __device__ sptr(sptr&& x) > │ { > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ > │ __device__ sptr& operator=(sptr& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ this->base->refc++; > │ } > │ return *this; > │ } > │ > │ __device__ sptr& operator=(sptr&& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ return *this; > │ } > │ }; > │ > │ template <typename el> > │ struct csptr : public sptr<el> > │ { // Shared pointer for closures specifically. > │ using sptr<el>::sptr; > │ template <typename... Args> > │ __device__ auto operator()(Args... args) -> > decltype(this->base->operator()(args...)) > │ { > │ return this->base->operator()(args...); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array > │ { > │ el ptr[max_length]; > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < max_length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array_list > │ { > │ default_int length{ 0 }; > │ el ptr[max_length]; > │ > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __device__ void unsafe_set_length(default_int i) { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_base > │ { > │ int refc{ 0 }; > │ el* ptr; > │ > │ __device__ dynamic_array_base() : ptr(new el[max_length]) > {} > │ __device__ ~dynamic_array_base() { delete[] this->ptr; } > │ > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array > │ { > │ sptr<dynamic_array_base<el, max_length>> ptr; > │ > │ __device__ dynamic_array() = default; > │ __device__ dynamic_array(bool t) : ptr(new > dynamic_array_base<el, max_length>()) {} > │ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list_base > │ { > │ int refc{ 0 }; > │ default_int length{ 0 }; > │ el* ptr; > │ > │ __device__ dynamic_array_list_base() : ptr(new > el[max_length]) {} > │ __device__ dynamic_array_list_base(default_int l) : > ptr(new el[max_length]) { this->unsafe_set_length(l); } > │ __device__ ~dynamic_array_list_base() { delete[] > this->ptr; } > │ > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __device__ void unsafe_set_length(default_int i) { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list > │ { > │ sptr<dynamic_array_list_base<el, max_length>> ptr; > │ > │ __device__ dynamic_array_list() = default; > │ __device__ dynamic_array_list(default_int l) : ptr(new > dynamic_array_list_base<el, max_length>(l)) {} > │ > │ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ __device__ void push(el& x) { > │ this->ptr.base->push(x); > │ } > │ __device__ void push(el&& x) { > │ this->ptr.base->push(std::move(x)); > │ } > │ __device__ el pop() { > │ return this->ptr.base->pop(); > │ } > │ // Should be used only during initialization. > │ __device__ void unsafe_set_length(default_int i) { > │ this->ptr.base->unsafe_set_length(i); > │ } > │ __device__ default_int length_() { > │ return this->ptr.base->length; > │ } > │ }; > │ """ > │ class static_array(): > │ def __init__(self, length): > │ self.ptr = [] > │ for _ in range(length): > │ self.ptr.append(None) > │ > │ def __getitem__(self, index): > │ assert 0 <= index < len(self.ptr), "The get index > needs to be in range." > │ return self.ptr[index] > │ > │ def __setitem__(self, index, value): > │ assert 0 <= index < len(self.ptr), "The set index > needs to be in range." > │ self.ptr[index] = value > │ > │ class static_array_list(static_array): > │ def __init__(self, length): > │ super().__init__(length) > │ self.length = 0 > │ > │ def __getitem__(self, index): > │ assert 0 <= index < self.length, "The get index needs > to be in range." > │ return self.ptr[index] > │ > │ def __setitem__(self, index, value): > │ assert 0 <= index < self.length, "The set index needs > to be in range." > │ self.ptr[index] = value > │ > │ def push(self,value): > │ assert (self.length < len(self.ptr)), "The length > before pushing has to be less than the maximum length of the array." > │ self.ptr[self.length] = value > │ self.length += 1 > │ > │ def pop(self): > │ assert (0 < self.length), "The length before popping > has to be greater than 0." > │ self.length -= 1 > │ return self.ptr[self.length] > │ > │ def unsafe_set_length(self,i): > │ assert 0 <= i <= len(self.ptr), "The new length has > to be in range." > │ self.length = i > │ > │ class dynamic_array(static_array): > │ pass > │ > │ class dynamic_array_list(static_array_list): > │ def length_(self): return self.length > │ > │ > │ kernels_main = r""" > │ """ > │ from main_auto import * > │ kernels = kernels_aux + kernels_main > │ import cupy as cp > │ import numpy as np > │ from dataclasses import dataclass > │ from typing import NamedTuple, Union, Callable, Tuple > │ i8 = int; i16 = int; i32 = int; i64 = int; u8 = int; u16 = > int; u32 = int; u64 = int; f32 = float; f64 = float; char = str; string = str > │ cuda = False > │ > │ > │ # fwd_dcls > │ # types > │ # functions > │ # main_defs > │ def main_body(): > │ return 0.3325000000000001 > │ > │ def main(): > │ r = main_body() > │ if cuda: cp.cuda.get_current_stream().synchronize() # > This line is here so the `__trap()` calls on the kernel aren't missed. > │ return r > │ > │ if __name__ == '__main__': result = main(); None if result is > None else print(result) > │ " > │ 00:01:01 v #1856 Supervisor.buildFile / > outputContentSeq2 unfoldAsync / msg: (Some > │ "kernels_aux = r""" > │ // The types of these two will be replaced during compilation > by the Spiral code generator. > │ // It matches on `using default_int = ` and `;` with the > inner part being replaced so the form should be kept as is. > │ // The two statements need to begin at the start of a line. > │ using default_int = int; > │ using default_uint = unsigned int; > │ > │ #ifndef __NVRTC__ > │ // NVRTC has these includes by default so they need to be > left out if it is used as the compiler. > │ #include <new> > │ #include <assert.h> > │ #include <stdio.h> > │ #endif > │ > │ // For error checking on the host. > │ #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, > __LINE__); } > │ template <typename T> inline __device__ void destroy(T& obj) > { obj.~T(); } > │ inline void gpuAssert(cudaError error, const char *file, int > line, bool abort=true) { > │ if (error != cudaSuccess) { > │ fprintf(stderr, "GPUassert: %s %s %d\n", > cudaGetErrorString(error), file, line); > │ if (abort) exit(error); > │ } > │ } > │ > │ template <typename el> > │ struct sptr // Shared pointer for the Spiral datatypes. They > have to have the refc field inside them to work. > │ { > │ el* base; > │ > │ __device__ sptr() : base(nullptr) {} > │ __device__ sptr(el* ptr) : base(ptr) { > this->base->refc++; } > │ > │ __device__ ~sptr() > │ { > │ if (this->base != nullptr && --this->base->refc == 0) > │ { > │ delete this->base; > │ this->base = nullptr; > │ } > │ } > │ > │ __device__ sptr(sptr& x) > │ { > │ this->base = x.base; > │ this->base->refc++; > │ } > │ > │ __device__ sptr(sptr&& x) > │ { > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ > │ __device__ sptr& operator=(sptr& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ this->base->refc++; > │ } > │ return *this; > │ } > │ > │ __device__ sptr& operator=(sptr&& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ return *this; > │ } > │ }; > │ > │ template <typename el> > │ struct csptr : public sptr<el> > │ { // Shared pointer for closures specifically. > │ using sptr<el>::sptr; > │ template <typename... Args> > │ __device__ auto operator()(Args... args) -> > decltype(this->base->operator()(args...)) > │ { > │ return this->base->operator()(args...); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array > │ { > │ el ptr[max_length]; > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < max_length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array_list > │ { > │ default_int length{ 0 }; > │ el ptr[max_length]; > │ > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __device__ void unsafe_set_length(default_int i) { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_base > │ { > │ int refc{ 0 }; > │ el* ptr; > │ > │ __device__ dynamic_array_base() : ptr(new el[max_length]) > {} > │ __device__ ~dynamic_array_base() { delete[] this->ptr; } > │ > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array > │ { > │ sptr<dynamic_array_base<el, max_length>> ptr; > │ > │ __device__ dynamic_array() = default; > │ __device__ dynamic_array(bool t) : ptr(new > dynamic_array_base<el, max_length>()) {} > │ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list_base > │ { > │ int refc{ 0 }; > │ default_int length{ 0 }; > │ el* ptr; > │ > │ __device__ dynamic_array_list_base() : ptr(new > el[max_length]) {} > │ __device__ dynamic_array_list_base(default_int l) : > ptr(new el[max_length]) { this->unsafe_set_length(l); } > │ __device__ ~dynamic_array_list_base() { delete[] > this->ptr; } > │ > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __device__ void unsafe_set_length(default_int i) { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list > │ { > │ sptr<dynamic_array_list_base<el, max_length>> ptr; > │ > │ __device__ dynamic_array_list() = default; > │ __device__ dynamic_array_list(default_int l) : ptr(new > dynamic_array_list_base<el, max_length>(l)) {} > │ > │ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ __device__ void push(el& x) { > │ this->ptr.base->push(x); > │ } > │ __device__ void push(el&& x) { > │ this->ptr.base->push(std::move(x)); > │ } > │ __device__ el pop() { > │ return this->ptr.base->pop(); > │ } > │ // Should be used only during initialization. > │ __device__ void unsafe_set_length(default_int i) { > │ this->ptr.base->unsafe_set_length(i); > │ } > │ __device__ default_int length_() { > │ return this->ptr.base->length; > │ } > │ }; > │ """ > │ class static_array(): > │ def __init__(self, length): > │ self.ptr = [] > │ for _ in range(length): > │ self.ptr.append(None) > │ > │ def __getitem__(self, index): > │ assert 0 <= index < len(self.ptr), "The get index > needs to be in range." > │ return self.ptr[index] > │ > │ def __setitem__(self, index, value): > │ assert 0 <= index < len(self.ptr), "The set index > needs to be in range." > │ self.ptr[index] = value > │ > │ class static_array_list(static_array): > │ def __init__(self, length): > │ super().__init__(length) > │ self.length = 0 > │ > │ def __getitem__(self, index): > │ assert 0 <= index < self.length, "The get index needs > to be in range." > │ return self.ptr[index] > │ > │ def __setitem__(self, index, value): > │ assert 0 <= index < self.length, "The set index needs > to be in range." > │ self.ptr[index] = value > │ > │ def push(self,value): > │ assert (self.length < len(self.ptr)), "The length > before pushing has to be less than the maximum length of the array." > │ self.ptr[self.length] = value > │ self.length += 1 > │ > │ def pop(self): > │ assert (0 < self.length), "The length before popping > has to be greater than 0." > │ self.length -= 1 > │ return self.ptr[self.length] > │ > │ def unsafe_set_length(self,i): > │ assert 0 <= i <= len(self.ptr), "The new length has > to be in range." > │ self.length = i > │ > │ class dynamic_array(static_array): > │ pass > │ > │ class dynamic_array_list(static_array_list): > │ def length_(self): return self.length > │ > │ > │ kernels_main = r""" > │ """ > │ from main_auto import * > │ kernels = kernels_aux + kernels_main > │ import cupy as cp > │ import numpy as np > │ from dataclasses import dataclass > │ from typing import NamedTuple, Union, Callable, Tuple > │ i8 = int; i16 = int; i32 = int; i64 = int; u8 = int; u16 = > int; u32 = int; u64 = int; f32 = float; f64 = float; char = str; string = str > │ cuda = False > │ > │ > │ # fwd_dcls > │ # types > │ # functions > │ # main_defs > │ def main_body(): > │ return 0.3325000000000001 > │ > │ def main(): > │ r = main_body() > │ if cuda: cp.cuda.get_current_stream().synchronize() # > This line is here so the `__trap()` calls on the kernel aren't missed. > │ return r > │ > │ if __name__ == '__main__': result = main(); None if result is > None else print(result) > │ ", > │ [], 0) > │ 00:01:01 v #1857 Supervisor.buildFile / ofSeqAsync / x: > (Some > │ "kernels_aux = r""" > │ // The types of these two will be replaced during compilation > by the Spiral code generator. > │ // It matches on `using default_int = ` and `;` with the > inner part being replaced so the form should be kept as is. > │ // The two statements need to begin at the start of a line. > │ using default_int = int; > │ using default_uint = unsigned int; > │ > │ #ifndef __NVRTC__ > │ // NVRTC has these includes by default so they need to be > left out if it is used as the compiler. > │ #include <new> > │ #include <assert.h> > │ #include <stdio.h> > │ #endif > │ > │ // For error checking on the host. > │ #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, > __LINE__); } > │ template <typename T> inline __device__ void destroy(T& obj) > { obj.~T(); } > │ inline void gpuAssert(cudaError error, const char *file, int > line, bool abort=true) { > │ if (error != cudaSuccess) { > │ fprintf(stderr, "GPUassert: %s %s %d\n", > cudaGetErrorString(error), file, line); > │ if (abort) exit(error); > │ } > │ } > │ > │ template <typename el> > │ struct sptr // Shared pointer for the Spiral datatypes. They > have to have the refc field inside them to work. > │ { > │ el* base; > │ > │ __device__ sptr() : base(nullptr) {} > │ __device__ sptr(el* ptr) : base(ptr) { > this->base->refc++; } > │ > │ __device__ ~sptr() > │ { > │ if (this->base != nullptr && --this->base->refc == 0) > │ { > │ delete this->base; > │ this->base = nullptr; > │ } > │ } > │ > │ __device__ sptr(sptr& x) > │ { > │ this->base = x.base; > │ this->base->refc++; > │ } > │ > │ __device__ sptr(sptr&& x) > │ { > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ > │ __device__ sptr& operator=(sptr& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ this->base->refc++; > │ } > │ return *this; > │ } > │ > │ __device__ sptr& operator=(sptr&& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ return *this; > │ } > │ }; > │ > │ template <typename el> > │ struct csptr : public sptr<el> > │ { // Shared pointer for closures specifically. > │ using sptr<el>::sptr; > │ template <typename... Args> > │ __device__ auto operator()(Args... args) -> > decltype(this->base->operator()(args...)) > │ { > │ return this->base->operator()(args...); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array > │ { > │ el ptr[max_length]; > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < max_length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array_list > │ { > │ default_int length{ 0 }; > │ el ptr[max_length]; > │ > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __device__ void unsafe_set_length(default_int i) { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_base > │ { > │ int refc{ 0 }; > │ el* ptr; > │ > │ __device__ dynamic_array_base() : ptr(new el[max_length]) > {} > │ __device__ ~dynamic_array_base() { delete[] this->ptr; } > │ > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array > │ { > │ sptr<dynamic_array_base<el, max_length>> ptr; > │ > │ __device__ dynamic_array() = default; > │ __device__ dynamic_array(bool t) : ptr(new > dynamic_array_base<el, max_length>()) {} > │ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list_base > │ { > │ int refc{ 0 }; > │ default_int length{ 0 }; > │ el* ptr; > │ > │ __device__ dynamic_array_list_base() : ptr(new > el[max_length]) {} > │ __device__ dynamic_array_list_base(default_int l) : > ptr(new el[max_length]) { this->unsafe_set_length(l); } > │ __device__ ~dynamic_array_list_base() { delete[] > this->ptr; } > │ > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __device__ void unsafe_set_length(default_int i) { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list > │ { > │ sptr<dynamic_array_list_base<el, max_length>> ptr; > │ > │ __device__ dynamic_array_list() = default; > │ __device__ dynamic_array_list(default_int l) : ptr(new > dynamic_array_list_base<el, max_length>(l)) {} > │ > │ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ __device__ void push(el& x) { > │ this->ptr.base->push(x); > │ } > │ __device__ void push(el&& x) { > │ this->ptr.base->push(std::move(x)); > │ } > │ __device__ el pop() { > │ return this->ptr.base->pop(); > │ } > │ // Should be used only during initialization. > │ __device__ void unsafe_set_length(default_int i) { > │ this->ptr.base->unsafe_set_length(i); > │ } > │ __device__ default_int length_() { > │ return this->ptr.base->length; > │ } > │ }; > │ """ > │ class static_array(): > │ def __init__(self, length): > │ self.ptr = [] > │ for _ in range(length): > │ self.ptr.append(None) > │ > │ def __getitem__(self, index): > │ assert 0 <= index < len(self.ptr), "The get index > needs to be in range." > │ return self.ptr[index] > │ > │ def __setitem__(self, index, value): > │ assert 0 <= index < len(self.ptr), "The set index > needs to be in range." > │ self.ptr[index] = value > │ > │ class static_array_list(static_array): > │ def __init__(self, length): > │ super().__init__(length) > │ self.length = 0 > │ > │ def __getitem__(self, index): > │ assert 0 <= index < self.length, "The get index needs > to be in range." > │ return self.ptr[index] > │ > │ def __setitem__(self, index, value): > │ assert 0 <= index < self.length, "The set index needs > to be in range." > │ self.ptr[index] = value > │ > │ def push(self,value): > │ assert (self.length < len(self.ptr)), "The length > before pushing has to be less than the maximum length of the array." > │ self.ptr[self.length] = value > │ self.length += 1 > │ > │ def pop(self): > │ assert (0 < self.length), "The length before popping > has to be greater than 0." > │ self.length -= 1 > │ return self.ptr[self.length] > │ > │ def unsafe_set_length(self,i): > │ assert 0 <= i <= len(self.ptr), "The new length has > to be in range." > │ self.length = i > │ > │ class dynamic_array(static_array): > │ pass > │ > │ class dynamic_array_list(static_array_list): > │ def length_(self): return self.length > │ > │ > │ kernels_main = r""" > │ """ > │ from main_auto import * > │ kernels = kernels_aux + kernels_main > │ import cupy as cp > │ import numpy as np > │ from dataclasses import dataclass > │ from typing import NamedTuple, Union, Callable, Tuple > │ i8 = int; i16 = int; i32 = int; i64 = int; u8 = int; u16 = > int; u32 = int; u64 = int; f32 = float; f64 = float; char = str; string = str > │ cuda = False > │ > │ > │ # fwd_dcls > │ # types > │ # functions > │ # main_defs > │ def main_body(): > │ return 0.3325000000000001 > │ > │ def main(): > │ r = main_body() > │ if cuda: cp.cuda.get_current_stream().synchronize() # > This line is here so the `__trap()` calls on the kernel aren't missed. > │ return r > │ > │ if __name__ == '__main__': result = main(); None if result is > None else print(result) > │ ", > │ [], 0) > │ 00:01:01 v #1858 Supervisor.buildFile / result: [] / > buildFileResult: Some > │ "kernels_aux = r""" > │ // The types of these two will be replaced during compilation > by the Spiral code generator. > │ // It matches on `using default_int = ` and `;` with the > inner part being replaced so the form should be kept as is. > │ // The two statements need to begin at the start of a line. > │ using default_int = int; > │ using default_uint = unsigned int; > │ > │ #ifndef __NVRTC__ > │ // NVRTC has these includes by default so they need to be > left out if it is used as the compiler. > │ #include <new> > │ #include <assert.h> > │ #include <stdio.h> > │ #endif > │ > │ // For error checking on the host. > │ #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, > __LINE__); } > │ template <typename T> inline __device__ void destroy(T& obj) > { obj.~T(); } > │ inline void gpuAssert(cudaError error, const char *file, int > line, bool abort=true) { > │ if (error != cudaSuccess) { > │ fprintf(stderr, "GPUassert: %s %s %d\n", > cudaGetErrorString(error), file, line); > │ if (abort) exit(error); > │ } > │ } > │ > │ template <typename el> > │ struct sptr // Shared pointer for the Spiral datatypes. They > have to have the refc field inside them to work. > │ { > │ el* base; > │ > │ __device__ sptr() : base(nullptr) {} > │ __device__ sptr(el* ptr) : base(ptr) { > this->base->refc++; } > │ > │ __device__ ~sptr() > │ { > │ if (this->base != nullptr && --this->base->refc == 0) > │ { > │ delete this->base; > │ this->base = nullptr; > │ } > │ } > │ > │ __device__ sptr(sptr& x) > │ { > │ this->base = x.base; > │ this->base->refc++; > │ } > │ > │ __device__ sptr(sptr&& x) > │ { > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ > │ __device__ sptr& operator=(sptr& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ this->base->refc++; > │ } > │ return *this; > │ } > │ > │ __device__ sptr& operator=(sptr&& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ return *this; > │ } > │ }; > │ > │ template <typename el> > │ struct csptr : public sptr<el> > │ { // Shared pointer for closures specifically. > │ using sptr<el>::sptr; > │ template <typename... Args> > │ __device__ auto operator()(Args... args) -> > decltype(this->base->operator()(args...)) > │ { > │ return this->base->operator()(args...); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array > │ { > │ el ptr[max_length]; > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < max_length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array_list > │ { > │ default_int length{ 0 }; > │ el ptr[max_length]; > │ > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __device__ void unsafe_set_length(default_int i) { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_base > │ { > │ int refc{ 0 }; > │ el* ptr; > │ > │ __device__ dynamic_array_base() : ptr(new el[max_length]) > {} > │ __device__ ~dynamic_array_base() { delete[] this->ptr; } > │ > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array > │ { > │ sptr<dynamic_array_base<el, max_length>> ptr; > │ > │ __device__ dynamic_array() = default; > │ __device__ dynamic_array(bool t) : ptr(new > dynamic_array_base<el, max_length>()) {} > │ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list_base > │ { > │ int refc{ 0 }; > │ default_int length{ 0 }; > │ el* ptr; > │ > │ __device__ dynamic_array_list_base() : ptr(new > el[max_length]) {} > │ __device__ dynamic_array_list_base(default_int l) : > ptr(new el[max_length]) { this->unsafe_set_length(l); } > │ __device__ ~dynamic_array_list_base() { delete[] > this->ptr; } > │ > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __device__ void unsafe_set_length(default_int i) { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list > │ { > │ sptr<dynamic_array_list_base<el, max_length>> ptr; > │ > │ __device__ dynamic_array_list() = default; > │ __device__ dynamic_array_list(default_int l) : ptr(new > dynamic_array_list_base<el, max_length>(l)) {} > │ > │ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ __device__ void push(el& x) { > │ this->ptr.base->push(x); > │ } > │ __device__ void push(el&& x) { > │ this->ptr.base->push(std::move(x)); > │ } > │ __device__ el pop() { > │ return this->ptr.base->pop(); > │ } > │ // Should be used only during initialization. > │ __device__ void unsafe_set_length(default_int i) { > │ this->ptr.base->unsafe_set_length(i); > │ } > │ __device__ default_int length_() { > │ return this->ptr.base->length; > │ } > │ }; > │ """ > │ class static_array(): > │ def __init__(self, length): > │ self.ptr = [] > │ for _ in range(length): > │ self.ptr.append(None) > │ > │ def __getitem__(self, index): > │ assert 0 <= index < len(self.ptr), "The get index > needs to be in range." > │ return self.ptr[index] > │ > │ def __setitem__(self, index, value): > │ assert 0 <= index < len(self.ptr), "The set index > needs to be in range." > │ self.ptr[index] = value > │ > │ class static_array_list(static_array): > │ def __init__(self, length): > │ super().__init__(length) > │ self.length = 0 > │ > │ def __getitem__(self, index): > │ assert 0 <= index < self.length, "The get index needs > to be in range." > │ return self.ptr[index] > │ > │ def __setitem__(self, index, value): > │ assert 0 <= index < self.length, "The set index needs > to be in range." > │ self.ptr[index] = value > │ > │ def push(self,value): > │ assert (self.length < len(self.ptr)), "The length > before pushing has to be less than the maximum length of the array." > │ self.ptr[self.length] = value > │ self.length += 1 > │ > │ def pop(self): > │ assert (0 < self.length), "The length before popping > has to be greater than 0." > │ self.length -= 1 > │ return self.ptr[self.length] > │ > │ def unsafe_set_length(self,i): > │ assert 0 <= i <= len(self.ptr), "The new length has > to be in range." > │ self.length = i > │ > │ class dynamic_array(static_array): > │ pass > │ > │ class dynamic_array_list(static_array_list): > │ def length_(self): return self.length > │ > │ > │ kernels_main = r""" > │ """ > │ from main_auto import * > │ kernels = kernels_aux + kernels_main > │ import cupy as cp > │ import numpy as np > │ from dataclasses import dataclass > │ from typing import NamedTuple, Union, Callable, Tuple > │ i8 = int; i16 = int; i32 = int; i64 = int; u8 = int; u16 = > int; u32 = int; u64 = int; f32 = float; f64 = float; char = str; string = str > │ cuda = False > │ > │ > │ # fwd_dcls > │ # types > │ # functions > │ # main_defs > │ def main_body(): > │ return 0.3325000000000001 > │ > │ def main(): > │ r = main_body() > │ if cuda: cp.cuda.get_current_stream().synchronize() # > This line is here so the `__trap()` calls on the kernel aren't missed. > │ return r > │ > │ if __name__ == '__main__': result = main(); None if result is > None else print(result) > │ " / typeErrorCount: 0 > │ 00:01:01 v #1859 Supervisor.buildFile / retry: 0 / > typeErrorCount: 0 / fileDir: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a4224c9f3d674d70 > fd56b6ecd3ae8c8ff3178a7124ae34f592336fef263568ea / targetDir: > /home/runner/work/polyglot/polyglot/target > │ Some > │ (Some > │ "kernels_aux = r""" > │ // The types of these two will be replaced during compilation > by the Spiral code generator. > │ // It matches on `using default_int = ` and `;` with the > inner part being replaced so the form should be kept as is. > │ // The two statements need to begin at the start of a line. > │ using default_int = int; > │ using default_uint = unsigned int; > │ > │ #ifndef __NVRTC__ > │ // NVRTC has these includes by default so they need to be > left out if it is used as the compiler. > │ #include <new> > │ #include <assert.h> > │ #include <stdio.h> > │ #endif > │ > │ // For error checking on the host. > │ #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, > __LINE__); } > │ template <typename T> inline __device__ void destroy(T& obj) > { obj.~T(); } > │ inline void gpuAssert(cudaError error, const char *file, int > line, bool abort=true) { > │ if (error != cudaSuccess) { > │ fprintf(stderr, "GPUassert: %s %s %d\n", > cudaGetErrorString(error), file, line); > │ if (abort) exit(error); > │ } > │ } > │ > │ template <typename el> > │ struct sptr // Shared pointer for the Spiral datatypes. They > have to have the refc field inside them to work. > │ { > │ el* base; > │ > │ __device__ sptr() : base(nullptr) {} > │ __device__ sptr(el* ptr) : base(ptr) { > this->base->refc++; } > │ > │ __device__ ~sptr() > │ { > │ if (this->base != nullptr && --this->base->refc == 0) > │ { > │ delete this->base; > │ this->base = nullptr; > │ } > │ } > │ > │ __device__ sptr(sptr& x) > │ { > │ this->base = x.base; > │ this->base->refc++; > │ } > │ > │ __device__ sptr(sptr&& x) > │ { > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ > │ __device__ sptr& operator=(sptr& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ this->base->refc++; > │ } > │ return *this; > │ } > │ > │ __device__ sptr& operator=(sptr&& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ return *this; > │ } > │ }; > │ > │ template <typename el> > │ struct csptr : public sptr<el> > │ { // Shared pointer for closures specifically. > │ using sptr<el>::sptr; > │ template <typename... Args> > │ __device__ auto operator()(Args... args) -> > decltype(this->base->operator()(args...)) > │ { > │ return this->base->operator()(args...); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array > │ { > │ el ptr[max_length]; > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < max_length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array_list > │ { > │ default_int length{ 0 }; > │ el ptr[max_length]; > │ > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __device__ void unsafe_set_length(default_int i) { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_base > │ { > │ int refc{ 0 }; > │ el* ptr; > │ > │ __device__ dynamic_array_base() : ptr(new el[max_length]) > {} > │ __device__ ~dynamic_array_base() { delete[] this->ptr; } > │ > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array > │ { > │ sptr<dynamic_array_base<el, max_length>> ptr; > │ > │ __device__ dynamic_array() = default; > │ __device__ dynamic_array(bool t) : ptr(new > dynamic_array_base<el, max_length>()) {} > │ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list_base > │ { > │ int refc{ 0 }; > │ default_int length{ 0 }; > │ el* ptr; > │ > │ __device__ dynamic_array_list_base() : ptr(new > el[max_length]) {} > │ __device__ dynamic_array_list_base(default_int l) : > ptr(new el[max_length]) { this->unsafe_set_length(l); } > │ __device__ ~dynamic_array_list_base() { delete[] > this->ptr; } > │ > │ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __device__ void unsafe_set_length(default_int i) { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list > │ { > │ sptr<dynamic_array_list_base<el, max_length>> ptr; > │ > │ __device__ dynamic_array_list() = default; > │ __device__ dynamic_array_list(default_int l) : ptr(new > dynamic_array_list_base<el, max_length>(l)) {} > │ > │ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ __device__ void push(el& x) { > │ this->ptr.base->push(x); > │ } > │ __device__ void push(el&& x) { > │ this->ptr.base->push(std::move(x)); > │ } > │ __device__ el pop() { > │ return this->ptr.base->pop(); > │ } > │ // Should be used only during initialization. > │ __device__ void unsafe_set_length(default_int i) { > │ this->ptr.base->unsafe_set_length(i); > │ } > │ __device__ default_int length_() { > │ return this->ptr.base->length; > │ } > │ }; > │ """ > │ class static_array(): > │ def __init__(self, length): > │ self.ptr = [] > │ for _ in range(length): > │ self.ptr.append(None) > │ > │ def __getitem__(self, index): > │ assert 0 <= index < len(self.ptr), "The get index > needs to be in range." > │ return self.ptr[index] > │ > │ def __setitem__(self, index, value): > │ assert 0 <= index < len(self.ptr), "The set index > needs to be in range." > │ self.ptr[index] = value > │ > │ class static_array_list(static_array): > │ def __init__(self, length): > │ super().__init__(length) > │ self.length = 0 > │ > │ def __getitem__(self, index): > │ assert 0 <= index < self.length, "The get index needs > to be in range." > │ return self.ptr[index] > │ > │ def __setitem__(self, index, value): > │ assert 0 <= index < self.length, "The set index needs > to be in range." > │ self.ptr[index] = value > │ > │ def push(self,value): > │ assert (self.length < len(self.ptr)), "The length > before pushing has to be less than the maximum length of the array." > │ self.ptr[self.length] = value > │ self.length += 1 > │ > │ def pop(self): > │ assert (0 < self.length), "The length before popping > has to be greater than 0." > │ self.length -= 1 > │ return self.ptr[self.length] > │ > │ def unsafe_set_length(self,i): > │ assert 0 <= i <= len(self.ptr), "The new length has > to be in range." > │ self.length = i > │ > │ class dynamic_array(static_array): > │ pass > │ > │ class dynamic_array_list(static_array_list): > │ def length_(self): return self.length > │ > │ > │ kernels_main = r""" > │ """ > │ from main_auto import * > │ kernels = kernels_aux + kernels_main > │ import cupy as cp > │ import numpy as np > │ from dataclasses import dataclass > │ from typing import NamedTuple, Union, Callable, Tuple > │ i8 = int; i16 = int; i32 = int; i64 = int; u8 = int; u16 = > int; u32 = int; u64 = int; f32 = float; f64 = float; char = str; string = str > │ cuda = False > │ > │ > │ # fwd_dcls > │ # types > │ # functions > │ # main_defs > │ def main_body(): > │ return 0.3325000000000001 > │ > │ def main(): > │ r = main_body() > │ if cuda: cp.cuda.get_current_stream().synchronize() # > This line is here so the `__trap()` calls on the kernel aren't missed. > │ return r > │ > │ if __name__ == '__main__': result = main(); None if result is > None else print(result) > │ ", > │ []) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > """ > inl init_series start end inc = > inl total : f64 = conv ((end - start) / inc) + 1 > listm.init total (conv >> (*) inc >> (+) start) : list f64 > > type integration = (f64 -> f64) -> f64 -> f64 -> f64 > > inl integral dt : integration = > fun f a b => > init_series (a + dt / 2) (b - dt / 2) dt > |> listm.map (f >> (*) dt) > |> listm.fold (+) 0 > > inl main () = > integral 0.1 (fun x => x ** 2) 0 1 |> convert : i32 > """ > |> fun code -> Spi (code, None) > |> buildCode Cpp [[||]] false 10000 None > |> Async.runWithTimeout 11000 > |> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> > List.map fst) > |> _assertEqual ( > Some ( > Some @"// The types of these two will be replaced during compilation by > the Spiral code generator. > // It matches on `using default_int = ` and `;` with the inner part being > replaced so the form should be kept as is. > // The two statements need to begin at the start of a line. > using default_int = int; > using default_uint = unsigned int; > > #ifndef __NVRTC__ > // NVRTC has these includes by default so they need to be left out if it is used > as the compiler. > #include <new> > #include <assert.h> > #include <stdio.h> > #endif > > // For error checking on the host. > #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); } > template <typename T> inline __host__ __device__ void destroy(T& obj) { > obj.~T(); } > inline void gpuAssert(cudaError error, const char *file, int line, bool > abort=true) { > if (error != cudaSuccess) { > fprintf(stderr, ""GPUassert: %s %s %d\n"", cudaGetErrorString(error), > file, line); > if (abort) exit(error); > } > } > > template <typename el> > struct sptr // Shared pointer for the Spiral datatypes. They have to have the > refc field inside them to work. > { > el* base; > > __host__ __device__ sptr() : base(nullptr) {} > __host__ __device__ sptr(el* ptr) : base(ptr) { this->base->refc++; } > > __host__ __device__ ~sptr() > { > if (this->base != nullptr && --this->base->refc == 0) > { > delete this->base; > this->base = nullptr; > } > } > > __host__ __device__ sptr(sptr& x) > { > this->base = x.base; > this->base->refc++; > } > > __host__ __device__ sptr(sptr&& x) > { > this->base = x.base; > x.base = nullptr; > } > > __host__ __device__ sptr& operator=(sptr& x) > { > if (this->base != x.base) > { > delete this->base; > this->base = x.base; > this->base->refc++; > } > return *this; > } > > __host__ __device__ sptr& operator=(sptr&& x) > { > if (this->base != x.base) > { > delete this->base; > this->base = x.base; > x.base = nullptr; > } > return *this; > } > }; > > template <typename el> > struct csptr : public sptr<el> > { // Shared pointer for closures specifically. > using sptr<el>::sptr; > template <typename... Args> > __host__ __device__ auto operator()(Args... args) -> > decltype(this->base->operator()(args...)) > { > return this->base->operator()(args...); > } > }; > > template <typename el, default_int max_length> > struct static_array > { > el ptr[[max_length]]; > __host__ __device__ el& operator[[]](default_int i) { > assert(""The index has to be in range."" && 0 <= i && i < max_length); > return this->ptr[[i]]; > } > }; > > template <typename el, default_int max_length> > struct static_array_list > { > default_int length{ 0 }; > el ptr[[max_length]]; > > __host__ __device__ el& operator[[]](default_int i) { > assert(""The index has to be in range."" && 0 <= i && i < this->length); > return this->ptr[[i]]; > } > __host__ __device__ void push(el& x) { > ptr[[this->length++]] = x; > assert(""The array after pushing should not be greater than max > length."" && this->length <= max_length); > } > __host__ __device__ void push(el&& x) { > ptr[[this->length++]] = std::move(x); > assert(""The array after pushing should not be greater than max > length."" && this->length <= max_length); > } > __host__ __device__ el pop() { > assert(""The array before popping should be greater than 0."" && 0 < > this->length); > auto x = ptr[[--this->length]]; > ptr[[this->length]].~el(); > new (&ptr[[this->length]]) el(); > return x; > } > // Should be used only during initialization. > __host__ __device__ void unsafe_set_length(default_int i) { > assert(""The new length should be in range."" && 0 <= i && i <= > max_length); > this->length = i; > } > }; > > template <typename el, default_int max_length> > struct dynamic_array_base > { > int refc{ 0 }; > el* ptr; > > __host__ __device__ dynamic_array_base() : ptr(new el[[max_length]]) {} > __host__ __device__ ~dynamic_array_base() { delete[[]] this->ptr; } > > __host__ __device__ el& operator[[]](default_int i) { > assert(""The index has to be in range."" && 0 <= i && i < this->length); > return this->ptr[[i]]; > } > }; > > template <typename el, default_int max_length> > struct dynamic_array > { > sptr<dynamic_array_base<el, max_length>> ptr; > > __host__ __device__ dynamic_array() = default; > __host__ __device__ dynamic_array(bool t) : ptr(new dynamic_array_base<el, > max_length>()) {} > __host__ __device__ el& operator[[]](default_int i) { > return this->ptr.base->operator[[]](i); > } > }; > > template <typename el, default_int max_length> > struct dynamic_array_list_base > { > int refc{ 0 }; > default_int length{ 0 }; > el* ptr; > > __host__ __device__ dynamic_array_list_base() : ptr(new el[[max_length]]) {} > __host__ __device__ dynamic_array_list_base(default_int l) : ptr(new > el[[max_length]]) { this->unsafe_set_length(l); } > __host__ __device__ ~dynamic_array_list_base() { delete[[]] this->ptr; } > > __host__ __device__ el& operator[[]](default_int i) { > assert(""The index has to be in range."" && 0 <= i && i < this->length); > return this->ptr[[i]]; > } > __host__ __device__ void push(el& x) { > ptr[[this->length++]] = x; > assert(""The array after pushing should not be greater than max > length."" && this->length <= max_length); > } > __host__ __device__ void push(el&& x) { > ptr[[this->length++]] = std::move(x); > assert(""The array after pushing should not be greater than max > length."" && this->length <= max_length); > } > __host__ __device__ el pop() { > assert(""The array before popping should be greater than 0."" && 0 < > this->length); > auto x = ptr[[--this->length]]; > ptr[[this->length]].~el(); > new (&ptr[[this->length]]) el(); > return x; > } > // Should be used only during initialization. > __host__ __device__ void unsafe_set_length(default_int i) { > assert(""The new length should be in range."" && 0 <= i && i <= > max_length); > this->length = i; > } > }; > > template <typename el, default_int max_length> > struct dynamic_array_list > { > sptr<dynamic_array_list_base<el, max_length>> ptr; > > __host__ __device__ dynamic_array_list() = default; > __host__ __device__ dynamic_array_list(default_int l) : ptr(new > dynamic_array_list_base<el, max_length>(l)) {} > > __host__ __device__ el& operator[[]](default_int i) { > return this->ptr.base->operator[[]](i); > } > __host__ __device__ void push(el& x) { > this->ptr.base->push(x); > } > __host__ __device__ void push(el&& x) { > this->ptr.base->push(std::move(x)); > } > __host__ __device__ el pop() { > return this->ptr.base->pop(); > } > // Should be used only during initialization. > __host__ __device__ void unsafe_set_length(default_int i) { > this->ptr.base->unsafe_set_length(i); > } > __host__ __device__ default_int length_() { > return this->ptr.base->length; > } > }; > #include ""main.auto.cu"" > namespace Device { > } > int main_body() { > int v3; > v3 = ; > return v3; > } > int main(){ > auto r = main_body(); > gpuErrchk(cudaDeviceSynchronize()); // This line is here so the `__trap()` > calls on the kernel aren't missed. > return r; > } > ", > [[]] > ) > ) > > ── [ 344.40ms - stdout ] ─────────────────────────────────────────────────────── > │ 00:01:01 v #1877 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a702c5b29a050ecc > fe7c911beeea63f353f61e71985bbebdb653ac32f3395c52/main.spi > │ 00:01:01 v #1878 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a702c5b29a050ecc > fe7c911beeea63f353f61e71985bbebdb653ac32f3395c52/main.spi' > │ 00:01:01 v #1879 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a702c5b29a050ecc > fe7c911beeea63f353f61e71985bbebdb653ac32f3395c52/main.spi > │ 00:01:01 v #1880 Supervisor.buildFile / fullPathUri: > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a702c5b2 > 9a050eccfe7c911beeea63f353f61e71985bbebdb653ac32f3395c52/main.spi" > │ 00:01:01 v #1881 Supervisor.buildFile / _fileOpenResult: > <null> > │ 00:01:01 v #1882 Supervisor.buildFile / before result: > () > │ 00:01:01 v #2120 Supervisor.buildFile / buildFileResult: > Some > │ "// The types of these two will be replaced during > compilation by the Spiral code generator. > │ // It matches on `using default_int = ` and `;` with the > inner part being replaced so the form should be kept as is. > │ // The two statements need to begin at the start of a line. > │ using default_int = int; > │ using default_uint = unsigned int; > │ > │ #ifndef __NVRTC__ > │ // NVRTC has these includes by default so they need to be > left out if it is used as the compiler. > │ #include <new> > │ #include <assert.h> > │ #include <stdio.h> > │ #endif > │ > │ // For error checking on the host. > │ #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, > __LINE__); } > │ template <typename T> inline __host__ __device__ void > destroy(T& obj) { obj.~T(); } > │ inline void gpuAssert(cudaError error, const char *file, int > line, bool abort=true) { > │ if (error != cudaSuccess) { > │ fprintf(stderr, "GPUassert: %s %s %d\n", > cudaGetErrorString(error), file, line); > │ if (abort) exit(error); > │ } > │ } > │ > │ template <typename el> > │ struct sptr // Shared pointer for the Spiral datatypes. They > have to have the refc field inside them to work. > │ { > │ el* base; > │ > │ __host__ __device__ sptr() : base(nullptr) {} > │ __host__ __device__ sptr(el* ptr) : base(ptr) { > this->base->refc++; } > │ > │ __host__ __device__ ~sptr() > │ { > │ if (this->base != nullptr && --this->base->refc == 0) > │ { > │ delete this->base; > │ this->base = nullptr; > │ } > │ } > │ > │ __host__ __device__ sptr(sptr& x) > │ { > │ this->base = x.base; > │ this->base->refc++; > │ } > │ > │ __host__ __device__ sptr(sptr&& x) > │ { > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ > │ __host__ __device__ sptr& operator=(sptr& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ this->base->refc++; > │ } > │ return *this; > │ } > │ > │ __host__ __device__ sptr& operator=(sptr&& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ return *this; > │ } > │ }; > │ > │ template <typename el> > │ struct csptr : public sptr<el> > │ { // Shared pointer for closures specifically. > │ using sptr<el>::sptr; > │ template <typename... Args> > │ __host__ __device__ auto operator()(Args... args) -> > decltype(this->base->operator()(args...)) > │ { > │ return this->base->operator()(args...); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array > │ { > │ el ptr[max_length]; > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < max_length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array_list > │ { > │ default_int length{ 0 }; > │ el ptr[max_length]; > │ > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __host__ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __host__ __device__ void unsafe_set_length(default_int i) > { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_base > │ { > │ int refc{ 0 }; > │ el* ptr; > │ > │ __host__ __device__ dynamic_array_base() : ptr(new > el[max_length]) {} > │ __host__ __device__ ~dynamic_array_base() { delete[] > this->ptr; } > │ > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array > │ { > │ sptr<dynamic_array_base<el, max_length>> ptr; > │ > │ __host__ __device__ dynamic_array() = default; > │ __host__ __device__ dynamic_array(bool t) : ptr(new > dynamic_array_base<el, max_length>()) {} > │ __host__ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list_base > │ { > │ int refc{ 0 }; > │ default_int length{ 0 }; > │ el* ptr; > │ > │ __host__ __device__ dynamic_array_list_base() : ptr(new > el[max_length]) {} > │ __host__ __device__ dynamic_array_list_base(default_int > l) : ptr(new el[max_length]) { this->unsafe_set_length(l); } > │ __host__ __device__ ~dynamic_array_list_base() { delete[] > this->ptr; } > │ > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __host__ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __host__ __device__ void unsafe_set_length(default_int i) > { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list > │ { > │ sptr<dynamic_array_list_base<el, max_length>> ptr; > │ > │ __host__ __device__ dynamic_array_list() = default; > │ __host__ __device__ dynamic_array_list(default_int l) : > ptr(new dynamic_array_list_base<el, max_length>(l)) {} > │ > │ __host__ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ __host__ __device__ void push(el& x) { > │ this->ptr.base->push(x); > │ } > │ __host__ __device__ void push(el&& x) { > │ this->ptr.base->push(std::move(x)); > │ } > │ __host__ __device__ el pop() { > │ return this->ptr.base->pop(); > │ } > │ // Should be used only during initialization. > │ __host__ __device__ void unsafe_set_length(default_int i) > { > │ this->ptr.base->unsafe_set_length(i); > │ } > │ __host__ __device__ default_int length_() { > │ return this->ptr.base->length; > │ } > │ }; > │ #include "main.auto.cu" > │ namespace Device { > │ } > │ int main_body() { > │ int v3; > │ v3 = ; > │ return v3; > │ } > │ int main(){ > │ auto r = main_body(); > │ gpuErrchk(cudaDeviceSynchronize()); // This line is here > so the `__trap()` calls on the kernel aren't missed. > │ return r; > │ } > │ " > │ 00:01:01 v #2121 Supervisor.buildFile / > outputContentSeq2 unfoldAsync / msg: (Some > │ "// The types of these two will be replaced during > compilation by the Spiral code generator. > │ // It matches on `using default_int = ` and `;` with the > inner part being replaced so the form should be kept as is. > │ // The two statements need to begin at the start of a line. > │ using default_int = int; > │ using default_uint = unsigned int; > │ > │ #ifndef __NVRTC__ > │ // NVRTC has these includes by default so they need to be > left out if it is used as the compiler. > │ #include <new> > │ #include <assert.h> > │ #include <stdio.h> > │ #endif > │ > │ // For error checking on the host. > │ #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, > __LINE__); } > │ template <typename T> inline __host__ __device__ void > destroy(T& obj) { obj.~T(); } > │ inline void gpuAssert(cudaError error, const char *file, int > line, bool abort=true) { > │ if (error != cudaSuccess) { > │ fprintf(stderr, "GPUassert: %s %s %d\n", > cudaGetErrorString(error), file, line); > │ if (abort) exit(error); > │ } > │ } > │ > │ template <typename el> > │ struct sptr // Shared pointer for the Spiral datatypes. They > have to have the refc field inside them to work. > │ { > │ el* base; > │ > │ __host__ __device__ sptr() : base(nullptr) {} > │ __host__ __device__ sptr(el* ptr) : base(ptr) { > this->base->refc++; } > │ > │ __host__ __device__ ~sptr() > │ { > │ if (this->base != nullptr && --this->base->refc == 0) > │ { > │ delete this->base; > │ this->base = nullptr; > │ } > │ } > │ > │ __host__ __device__ sptr(sptr& x) > │ { > │ this->base = x.base; > │ this->base->refc++; > │ } > │ > │ __host__ __device__ sptr(sptr&& x) > │ { > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ > │ __host__ __device__ sptr& operator=(sptr& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ this->base->refc++; > │ } > │ return *this; > │ } > │ > │ __host__ __device__ sptr& operator=(sptr&& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ return *this; > │ } > │ }; > │ > │ template <typename el> > │ struct csptr : public sptr<el> > │ { // Shared pointer for closures specifically. > │ using sptr<el>::sptr; > │ template <typename... Args> > │ __host__ __device__ auto operator()(Args... args) -> > decltype(this->base->operator()(args...)) > │ { > │ return this->base->operator()(args...); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array > │ { > │ el ptr[max_length]; > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < max_length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array_list > │ { > │ default_int length{ 0 }; > │ el ptr[max_length]; > │ > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __host__ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __host__ __device__ void unsafe_set_length(default_int i) > { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_base > │ { > │ int refc{ 0 }; > │ el* ptr; > │ > │ __host__ __device__ dynamic_array_base() : ptr(new > el[max_length]) {} > │ __host__ __device__ ~dynamic_array_base() { delete[] > this->ptr; } > │ > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array > │ { > │ sptr<dynamic_array_base<el, max_length>> ptr; > │ > │ __host__ __device__ dynamic_array() = default; > │ __host__ __device__ dynamic_array(bool t) : ptr(new > dynamic_array_base<el, max_length>()) {} > │ __host__ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list_base > │ { > │ int refc{ 0 }; > │ default_int length{ 0 }; > │ el* ptr; > │ > │ __host__ __device__ dynamic_array_list_base() : ptr(new > el[max_length]) {} > │ __host__ __device__ dynamic_array_list_base(default_int > l) : ptr(new el[max_length]) { this->unsafe_set_length(l); } > │ __host__ __device__ ~dynamic_array_list_base() { delete[] > this->ptr; } > │ > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __host__ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __host__ __device__ void unsafe_set_length(default_int i) > { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list > │ { > │ sptr<dynamic_array_list_base<el, max_length>> ptr; > │ > │ __host__ __device__ dynamic_array_list() = default; > │ __host__ __device__ dynamic_array_list(default_int l) : > ptr(new dynamic_array_list_base<el, max_length>(l)) {} > │ > │ __host__ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ __host__ __device__ void push(el& x) { > │ this->ptr.base->push(x); > │ } > │ __host__ __device__ void push(el&& x) { > │ this->ptr.base->push(std::move(x)); > │ } > │ __host__ __device__ el pop() { > │ return this->ptr.base->pop(); > │ } > │ // Should be used only during initialization. > │ __host__ __device__ void unsafe_set_length(default_int i) > { > │ this->ptr.base->unsafe_set_length(i); > │ } > │ __host__ __device__ default_int length_() { > │ return this->ptr.base->length; > │ } > │ }; > │ #include "main.auto.cu" > │ namespace Device { > │ } > │ int main_body() { > │ int v3; > │ v3 = ; > │ return v3; > │ } > │ int main(){ > │ auto r = main_body(); > │ gpuErrchk(cudaDeviceSynchronize()); // This line is here > so the `__trap()` calls on the kernel aren't missed. > │ return r; > │ } > │ ", > │ [], 0) > │ 00:01:01 v #2122 Supervisor.buildFile / ofSeqAsync / x: > (Some > │ "// The types of these two will be replaced during > compilation by the Spiral code generator. > │ // It matches on `using default_int = ` and `;` with the > inner part being replaced so the form should be kept as is. > │ // The two statements need to begin at the start of a line. > │ using default_int = int; > │ using default_uint = unsigned int; > │ > │ #ifndef __NVRTC__ > │ // NVRTC has these includes by default so they need to be > left out if it is used as the compiler. > │ #include <new> > │ #include <assert.h> > │ #include <stdio.h> > │ #endif > │ > │ // For error checking on the host. > │ #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, > __LINE__); } > │ template <typename T> inline __host__ __device__ void > destroy(T& obj) { obj.~T(); } > │ inline void gpuAssert(cudaError error, const char *file, int > line, bool abort=true) { > │ if (error != cudaSuccess) { > │ fprintf(stderr, "GPUassert: %s %s %d\n", > cudaGetErrorString(error), file, line); > │ if (abort) exit(error); > │ } > │ } > │ > │ template <typename el> > │ struct sptr // Shared pointer for the Spiral datatypes. They > have to have the refc field inside them to work. > │ { > │ el* base; > │ > │ __host__ __device__ sptr() : base(nullptr) {} > │ __host__ __device__ sptr(el* ptr) : base(ptr) { > this->base->refc++; } > │ > │ __host__ __device__ ~sptr() > │ { > │ if (this->base != nullptr && --this->base->refc == 0) > │ { > │ delete this->base; > │ this->base = nullptr; > │ } > │ } > │ > │ __host__ __device__ sptr(sptr& x) > │ { > │ this->base = x.base; > │ this->base->refc++; > │ } > │ > │ __host__ __device__ sptr(sptr&& x) > │ { > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ > │ __host__ __device__ sptr& operator=(sptr& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ this->base->refc++; > │ } > │ return *this; > │ } > │ > │ __host__ __device__ sptr& operator=(sptr&& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ return *this; > │ } > │ }; > │ > │ template <typename el> > │ struct csptr : public sptr<el> > │ { // Shared pointer for closures specifically. > │ using sptr<el>::sptr; > │ template <typename... Args> > │ __host__ __device__ auto operator()(Args... args) -> > decltype(this->base->operator()(args...)) > │ { > │ return this->base->operator()(args...); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array > │ { > │ el ptr[max_length]; > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < max_length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array_list > │ { > │ default_int length{ 0 }; > │ el ptr[max_length]; > │ > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __host__ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __host__ __device__ void unsafe_set_length(default_int i) > { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_base > │ { > │ int refc{ 0 }; > │ el* ptr; > │ > │ __host__ __device__ dynamic_array_base() : ptr(new > el[max_length]) {} > │ __host__ __device__ ~dynamic_array_base() { delete[] > this->ptr; } > │ > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array > │ { > │ sptr<dynamic_array_base<el, max_length>> ptr; > │ > │ __host__ __device__ dynamic_array() = default; > │ __host__ __device__ dynamic_array(bool t) : ptr(new > dynamic_array_base<el, max_length>()) {} > │ __host__ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list_base > │ { > │ int refc{ 0 }; > │ default_int length{ 0 }; > │ el* ptr; > │ > │ __host__ __device__ dynamic_array_list_base() : ptr(new > el[max_length]) {} > │ __host__ __device__ dynamic_array_list_base(default_int > l) : ptr(new el[max_length]) { this->unsafe_set_length(l); } > │ __host__ __device__ ~dynamic_array_list_base() { delete[] > this->ptr; } > │ > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __host__ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __host__ __device__ void unsafe_set_length(default_int i) > { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list > │ { > │ sptr<dynamic_array_list_base<el, max_length>> ptr; > │ > │ __host__ __device__ dynamic_array_list() = default; > │ __host__ __device__ dynamic_array_list(default_int l) : > ptr(new dynamic_array_list_base<el, max_length>(l)) {} > │ > │ __host__ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ __host__ __device__ void push(el& x) { > │ this->ptr.base->push(x); > │ } > │ __host__ __device__ void push(el&& x) { > │ this->ptr.base->push(std::move(x)); > │ } > │ __host__ __device__ el pop() { > │ return this->ptr.base->pop(); > │ } > │ // Should be used only during initialization. > │ __host__ __device__ void unsafe_set_length(default_int i) > { > │ this->ptr.base->unsafe_set_length(i); > │ } > │ __host__ __device__ default_int length_() { > │ return this->ptr.base->length; > │ } > │ }; > │ #include "main.auto.cu" > │ namespace Device { > │ } > │ int main_body() { > │ int v3; > │ v3 = ; > │ return v3; > │ } > │ int main(){ > │ auto r = main_body(); > │ gpuErrchk(cudaDeviceSynchronize()); // This line is here > so the `__trap()` calls on the kernel aren't missed. > │ return r; > │ } > │ ", > │ [], 0) > │ 00:01:01 v #2123 Supervisor.buildFile / result: [] / > buildFileResult: Some > │ "// The types of these two will be replaced during > compilation by the Spiral code generator. > │ // It matches on `using default_int = ` and `;` with the > inner part being replaced so the form should be kept as is. > │ // The two statements need to begin at the start of a line. > │ using default_int = int; > │ using default_uint = unsigned int; > │ > │ #ifndef __NVRTC__ > │ // NVRTC has these includes by default so they need to be > left out if it is used as the compiler. > │ #include <new> > │ #include <assert.h> > │ #include <stdio.h> > │ #endif > │ > │ // For error checking on the host. > │ #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, > __LINE__); } > │ template <typename T> inline __host__ __device__ void > destroy(T& obj) { obj.~T(); } > │ inline void gpuAssert(cudaError error, const char *file, int > line, bool abort=true) { > │ if (error != cudaSuccess) { > │ fprintf(stderr, "GPUassert: %s %s %d\n", > cudaGetErrorString(error), file, line); > │ if (abort) exit(error); > │ } > │ } > │ > │ template <typename el> > │ struct sptr // Shared pointer for the Spiral datatypes. They > have to have the refc field inside them to work. > │ { > │ el* base; > │ > │ __host__ __device__ sptr() : base(nullptr) {} > │ __host__ __device__ sptr(el* ptr) : base(ptr) { > this->base->refc++; } > │ > │ __host__ __device__ ~sptr() > │ { > │ if (this->base != nullptr && --this->base->refc == 0) > │ { > │ delete this->base; > │ this->base = nullptr; > │ } > │ } > │ > │ __host__ __device__ sptr(sptr& x) > │ { > │ this->base = x.base; > │ this->base->refc++; > │ } > │ > │ __host__ __device__ sptr(sptr&& x) > │ { > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ > │ __host__ __device__ sptr& operator=(sptr& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ this->base->refc++; > │ } > │ return *this; > │ } > │ > │ __host__ __device__ sptr& operator=(sptr&& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ return *this; > │ } > │ }; > │ > │ template <typename el> > │ struct csptr : public sptr<el> > │ { // Shared pointer for closures specifically. > │ using sptr<el>::sptr; > │ template <typename... Args> > │ __host__ __device__ auto operator()(Args... args) -> > decltype(this->base->operator()(args...)) > │ { > │ return this->base->operator()(args...); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array > │ { > │ el ptr[max_length]; > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < max_length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array_list > │ { > │ default_int length{ 0 }; > │ el ptr[max_length]; > │ > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __host__ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __host__ __device__ void unsafe_set_length(default_int i) > { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_base > │ { > │ int refc{ 0 }; > │ el* ptr; > │ > │ __host__ __device__ dynamic_array_base() : ptr(new > el[max_length]) {} > │ __host__ __device__ ~dynamic_array_base() { delete[] > this->ptr; } > │ > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array > │ { > │ sptr<dynamic_array_base<el, max_length>> ptr; > │ > │ __host__ __device__ dynamic_array() = default; > │ __host__ __device__ dynamic_array(bool t) : ptr(new > dynamic_array_base<el, max_length>()) {} > │ __host__ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list_base > │ { > │ int refc{ 0 }; > │ default_int length{ 0 }; > │ el* ptr; > │ > │ __host__ __device__ dynamic_array_list_base() : ptr(new > el[max_length]) {} > │ __host__ __device__ dynamic_array_list_base(default_int > l) : ptr(new el[max_length]) { this->unsafe_set_length(l); } > │ __host__ __device__ ~dynamic_array_list_base() { delete[] > this->ptr; } > │ > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __host__ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __host__ __device__ void unsafe_set_length(default_int i) > { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list > │ { > │ sptr<dynamic_array_list_base<el, max_length>> ptr; > │ > │ __host__ __device__ dynamic_array_list() = default; > │ __host__ __device__ dynamic_array_list(default_int l) : > ptr(new dynamic_array_list_base<el, max_length>(l)) {} > │ > │ __host__ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ __host__ __device__ void push(el& x) { > │ this->ptr.base->push(x); > │ } > │ __host__ __device__ void push(el&& x) { > │ this->ptr.base->push(std::move(x)); > │ } > │ __host__ __device__ el pop() { > │ return this->ptr.base->pop(); > │ } > │ // Should be used only during initialization. > │ __host__ __device__ void unsafe_set_length(default_int i) > { > │ this->ptr.base->unsafe_set_length(i); > │ } > │ __host__ __device__ default_int length_() { > │ return this->ptr.base->length; > │ } > │ }; > │ #include "main.auto.cu" > │ namespace Device { > │ } > │ int main_body() { > │ int v3; > │ v3 = ; > │ return v3; > │ } > │ int main(){ > │ auto r = main_body(); > │ gpuErrchk(cudaDeviceSynchronize()); // This line is here > so the `__trap()` calls on the kernel aren't missed. > │ return r; > │ } > │ " / typeErrorCount: 0 > │ 00:01:01 v #2124 Supervisor.buildFile / retry: 0 / > typeErrorCount: 0 / fileDir: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a702c5b29a050ecc > fe7c911beeea63f353f61e71985bbebdb653ac32f3395c52 / targetDir: > /home/runner/work/polyglot/polyglot/target > │ Some > │ (Some > │ "// The types of these two will be replaced during > compilation by the Spiral code generator. > │ // It matches on `using default_int = ` and `;` with the > inner part being replaced so the form should be kept as is. > │ // The two statements need to begin at the start of a line. > │ using default_int = int; > │ using default_uint = unsigned int; > │ > │ #ifndef __NVRTC__ > │ // NVRTC has these includes by default so they need to be > left out if it is used as the compiler. > │ #include <new> > │ #include <assert.h> > │ #include <stdio.h> > │ #endif > │ > │ // For error checking on the host. > │ #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, > __LINE__); } > │ template <typename T> inline __host__ __device__ void > destroy(T& obj) { obj.~T(); } > │ inline void gpuAssert(cudaError error, const char *file, int > line, bool abort=true) { > │ if (error != cudaSuccess) { > │ fprintf(stderr, "GPUassert: %s %s %d\n", > cudaGetErrorString(error), file, line); > │ if (abort) exit(error); > │ } > │ } > │ > │ template <typename el> > │ struct sptr // Shared pointer for the Spiral datatypes. They > have to have the refc field inside them to work. > │ { > │ el* base; > │ > │ __host__ __device__ sptr() : base(nullptr) {} > │ __host__ __device__ sptr(el* ptr) : base(ptr) { > this->base->refc++; } > │ > │ __host__ __device__ ~sptr() > │ { > │ if (this->base != nullptr && --this->base->refc == 0) > │ { > │ delete this->base; > │ this->base = nullptr; > │ } > │ } > │ > │ __host__ __device__ sptr(sptr& x) > │ { > │ this->base = x.base; > │ this->base->refc++; > │ } > │ > │ __host__ __device__ sptr(sptr&& x) > │ { > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ > │ __host__ __device__ sptr& operator=(sptr& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ this->base->refc++; > │ } > │ return *this; > │ } > │ > │ __host__ __device__ sptr& operator=(sptr&& x) > │ { > │ if (this->base != x.base) > │ { > │ delete this->base; > │ this->base = x.base; > │ x.base = nullptr; > │ } > │ return *this; > │ } > │ }; > │ > │ template <typename el> > │ struct csptr : public sptr<el> > │ { // Shared pointer for closures specifically. > │ using sptr<el>::sptr; > │ template <typename... Args> > │ __host__ __device__ auto operator()(Args... args) -> > decltype(this->base->operator()(args...)) > │ { > │ return this->base->operator()(args...); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array > │ { > │ el ptr[max_length]; > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < max_length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct static_array_list > │ { > │ default_int length{ 0 }; > │ el ptr[max_length]; > │ > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __host__ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __host__ __device__ void unsafe_set_length(default_int i) > { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_base > │ { > │ int refc{ 0 }; > │ el* ptr; > │ > │ __host__ __device__ dynamic_array_base() : ptr(new > el[max_length]) {} > │ __host__ __device__ ~dynamic_array_base() { delete[] > this->ptr; } > │ > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array > │ { > │ sptr<dynamic_array_base<el, max_length>> ptr; > │ > │ __host__ __device__ dynamic_array() = default; > │ __host__ __device__ dynamic_array(bool t) : ptr(new > dynamic_array_base<el, max_length>()) {} > │ __host__ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list_base > │ { > │ int refc{ 0 }; > │ default_int length{ 0 }; > │ el* ptr; > │ > │ __host__ __device__ dynamic_array_list_base() : ptr(new > el[max_length]) {} > │ __host__ __device__ dynamic_array_list_base(default_int > l) : ptr(new el[max_length]) { this->unsafe_set_length(l); } > │ __host__ __device__ ~dynamic_array_list_base() { delete[] > this->ptr; } > │ > │ __host__ __device__ el& operator[](default_int i) { > │ assert("The index has to be in range." && 0 <= i && i > < this->length); > │ return this->ptr[i]; > │ } > │ __host__ __device__ void push(el& x) { > │ ptr[this->length++] = x; > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ void push(el&& x) { > │ ptr[this->length++] = std::move(x); > │ assert("The array after pushing should not be greater > than max length." && this->length <= max_length); > │ } > │ __host__ __device__ el pop() { > │ assert("The array before popping should be greater > than 0." && 0 < this->length); > │ auto x = ptr[--this->length]; > │ ptr[this->length].~el(); > │ new (&ptr[this->length]) el(); > │ return x; > │ } > │ // Should be used only during initialization. > │ __host__ __device__ void unsafe_set_length(default_int i) > { > │ assert("The new length should be in range." && 0 <= i > && i <= max_length); > │ this->length = i; > │ } > │ }; > │ > │ template <typename el, default_int max_length> > │ struct dynamic_array_list > │ { > │ sptr<dynamic_array_list_base<el, max_length>> ptr; > │ > │ __host__ __device__ dynamic_array_list() = default; > │ __host__ __device__ dynamic_array_list(default_int l) : > ptr(new dynamic_array_list_base<el, max_length>(l)) {} > │ > │ __host__ __device__ el& operator[](default_int i) { > │ return this->ptr.base->operator[](i); > │ } > │ __host__ __device__ void push(el& x) { > │ this->ptr.base->push(x); > │ } > │ __host__ __device__ void push(el&& x) { > │ this->ptr.base->push(std::move(x)); > │ } > │ __host__ __device__ el pop() { > │ return this->ptr.base->pop(); > │ } > │ // Should be used only during initialization. > │ __host__ __device__ void unsafe_set_length(default_int i) > { > │ this->ptr.base->unsafe_set_length(i); > │ } > │ __host__ __device__ default_int length_() { > │ return this->ptr.base->length; > │ } > │ }; > │ #include "main.auto.cu" > │ namespace Device { > │ } > │ int main_body() { > │ int v3; > │ v3 = ; > │ return v3; > │ } > │ int main(){ > │ auto r = main_body(); > │ gpuErrchk(cudaDeviceSynchronize()); // This line is here > so the `__trap()` calls on the kernel aren't missed. > │ return r; > │ } > │ ", > │ []) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > """ > inl init_series start end inc = > inl total : f64 = conv ((end - start) / inc) + 1 > listm.init total (conv >> (*) inc >> (+) start) : list f64 > > type integration = (f64 -> f64) -> f64 -> f64 -> f64 > > inl integral dt : integration = > fun f a b => > init_series (a + dt / 2) (b - dt / 2) dt > |> listm.map (f >> (*) dt) > |> listm.fold (+) 0 > > inl main () = > integral 0.1 (fun x => x ** 2) 0 1 > """ > |> fun code -> Spi (code, None) > |> buildCode Gleam [[||]] false 10000 None > |> Async.runWithTimeout 11000 > |> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> > List.map fst) > |> _assertEqual ( > Some ( > Some "pub fn main () { 0.3325000000000001\n }", > [[]] > ) > ) > > ── [ 406.91ms - stdout ] ─────────────────────────────────────────────────────── > │ 00:01:01 v #2146 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/9fee147a19a3a90a > b5113d3c8fb7b0b2072de018aa3d73cd2d4eb0e7e7a32620/src/main.spi > │ 00:01:01 v #2147 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/9fee147a19a3a90a > b5113d3c8fb7b0b2072de018aa3d73cd2d4eb0e7e7a32620/src/main.spi' > │ 00:01:01 v #2148 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/9fee147a19a3a90a > b5113d3c8fb7b0b2072de018aa3d73cd2d4eb0e7e7a32620/src/main.spi > │ 00:01:01 v #2149 Supervisor.buildFile / fullPathUri: > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/9fee147a > 19a3a90ab5113d3c8fb7b0b2072de018aa3d73cd2d4eb0e7e7a32620/src/main.spi" > │ 00:01:01 v #2150 Supervisor.buildFile / _fileOpenResult: > <null> > │ 00:01:01 v #2151 Supervisor.buildFile / before result: > () > │ 00:01:02 v #2388 Supervisor.buildFile / buildFileResult: > Some "pub fn main () { 0.3325000000000001 > │ }" > │ 00:01:02 v #2389 Supervisor.buildFile / > outputContentSeq2 unfoldAsync / msg: (Some "pub fn main () { 0.3325000000000001 > │ }", [], 0) > │ 00:01:02 v #2390 Supervisor.buildFile / ofSeqAsync / x: > (Some "pub fn main () { 0.3325000000000001 > │ }", [], 0) > │ 00:01:02 v #2391 Supervisor.buildFile / result: [] / > buildFileResult: Some "pub fn main () { 0.3325000000000001 > │ }" / typeErrorCount: 0 > │ 00:01:02 v #2392 Supervisor.buildFile / retry: 0 / > typeErrorCount: 0 / fileDir: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/9fee147a19a3a90a > b5113d3c8fb7b0b2072de018aa3d73cd2d4eb0e7e7a32620/src / targetDir: > /home/runner/work/polyglot/polyglot/target > │ Some (Some "pub fn main () { 0.3325000000000001 > │ }", []) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > SpiralTrace.TraceLevel.US0_0 |> set_trace_level > """ > inl init_series start end inc = > inl total : f64 = conv ((end - start) / inc) + 1 > listm.init total (conv >> (*) inc >> (+) start) : list f64 > > type integration = (f64 -> f64) -> f64 -> f64 -> f64 > > inl integral dt : integration = > fun f a b => > init_series (a + dt / 2) (b - dt / 2) dt > |> listm.map (f >> (*) dt) > |> listm.fold (+) 0 > > inl main () = > integral 0.01 (fun x => x ** 2) 0 1 > """ > |> fun code -> Spi (code, None) > |> buildCode Fsharp [[||]] false 10000 None > |> Async.runWithTimeout 11000 > |> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> > List.map fst) > |> _assertEqual ( > Some ( > Some "0.33332500000000004\n", > [[]] > ) > ) > // |> _assertEqual None > // |> fun x -> printfn $"{x.ToDisplayString ()}" > > ── [ 340.85ms - stdout ] ─────────────────────────────────────────────────────── > │ 00:01:02 v #2417 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce > 3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi > │ 00:01:02 v #2418 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce > 3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi' > │ 00:01:02 v #2419 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce > 3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi > │ 00:01:02 v #2420 Supervisor.buildFile / fullPathUri: > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d9 > 7e6b50ce3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4/main.spi" > │ 00:01:02 v #2421 Supervisor.buildFile / _fileOpenResult: > <null> > │ 00:01:02 v #2422 Supervisor.buildFile / before result: > () > │ 00:01:02 v #2660 Supervisor.buildFile / buildFileResult: > Some "0.33332500000000004 > │ " > │ 00:01:02 v #2661 Supervisor.buildFile / > outputContentSeq2 unfoldAsync / msg: (Some "0.33332500000000004 > │ ", [], 0) > │ 00:01:02 v #2662 Supervisor.buildFile / ofSeqAsync / x: > (Some "0.33332500000000004 > │ ", [], 0) > │ 00:01:02 v #2663 Supervisor.buildFile / result: [] / > buildFileResult: Some "0.33332500000000004 > │ " / typeErrorCount: 0 > │ 00:01:02 v #2664 Supervisor.buildFile / retry: 0 / > typeErrorCount: 0 / fileDir: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/2acc44d97e6b50ce > 3caf39a0b93135633484d22c3ef6e7797ce64875a41451f4 / targetDir: > /home/runner/work/polyglot/polyglot/target > │ Some (Some "0.33332500000000004 > │ ", []) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > SpiralTrace.TraceLevel.US0_0 |> set_trace_level > "" > |> fun code -> Spi (code, None) > |> buildCode Fsharp [[||]] false 10000 None > |> Async.runWithTimeout 11000 > |> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> > List.map fst) > |> _assertEqual ( > Some ( > None, > [[ "Cannot find `main` in file main." ]] > ) > ) > > ── [ 352.04ms - stdout ] ─────────────────────────────────────────────────────── > │ 00:01:02 v #2686 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da9 > 67b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi > │ 00:01:02 v #2687 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da9 > 67b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi' > │ 00:01:02 v #2688 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da9 > 67b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi > │ 00:01:02 v #2689 Supervisor.buildFile / fullPathUri: > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342cc > c7da0da967b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi" > │ 00:01:02 v #2690 Supervisor.buildFile / _fileOpenResult: > <null> > │ 00:01:02 v #2691 Supervisor.buildFile / before result: > () > │ 00:01:02 v #2934 Supervisor.buildFile / buildFileResult: > None > │ 00:01:02 v #2935 Supervisor.buildFile / ofSeqAsync / x: > (None, [], 0) > │ 00:01:02 v #2948 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: Some((Cannot find `main` in file main., FatalError "Cannot > find `main` in file main.")) / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da9 > 67b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi' > │ 00:01:02 v #2949 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [ > │ [ > │ "Cannot find `main` in file main.", > │ { > │ "FatalError": "Cannot find `main` in file main." > │ } > │ ] > │ ] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da9 > 67b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa/main.spi > │ 00:01:02 v #2953 Supervisor.buildFile / outputChild / x: > Some > │ (Ok > │ (Some > │ (None, > │ [("Cannot find `main` in file main.", > │ FatalError "Cannot find `main` in file main.")], > 0))) > │ 00:01:02 v #2958 Supervisor.buildFile / ofSeqAsync / x: > (None, > │ [("Cannot find `main` in file main.", > │ FatalError "Cannot find `main` in file main.")], 0) > │ 00:01:02 v #2959 Supervisor.buildFile / result: > [("Cannot find `main` in file main.", > │ FatalError "Cannot find `main` in file main.")] / > buildFileResult: None / typeErrorCount: 0 > │ 00:01:02 v #2960 Supervisor.buildFile / retry: 0 / > typeErrorCount: 0 / fileDir: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/a65342ccc7da0da9 > 67b18d8e705d0260e9a932e5e68c0feb33db55c4d28170aa / targetDir: > /home/runner/work/polyglot/polyglot/target > │ Some (None, ["Cannot find `main` in file main."]) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > SpiralTrace.TraceLevel.US0_0 |> set_trace_level > """inl main () = > 1i32 / 0i32 > """ > |> fun code -> Spi (code, None) > |> buildCode Fsharp [[||]] false 10000 None > |> Async.runWithTimeout 11000 > |> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> > List.map fst) > |> _assertEqual ( > Some ( > None, > [[ "An attempt to divide by zero has been detected at compile time." ]] > ) > ) > > ── [ 426.59ms - stdout ] ─────────────────────────────────────────────────────── > │ 00:01:02 v #2978 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b > 1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi > │ 00:01:03 v #2979 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b > 1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi' > │ 00:01:03 v #2980 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b > 1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi > │ 00:01:03 v #2981 Supervisor.buildFile / fullPathUri: > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d > 9b06b75b1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi" > │ 00:01:03 v #2982 Supervisor.buildFile / _fileOpenResult: > <null> > │ 00:01:03 v #2983 Supervisor.buildFile / before result: > () > │ 00:01:03 v #3220 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: Some((An attempt to divide by zero has been detected at > compile time., TracedError > │ { message = "An attempt to divide by zero has been detected > at compile time." > │ trace = > │ ["Error trace on line: 1, column: 10 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b > 1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi . > │ inl main () = > │ ^ > │ "; > │ "Error trace on line: 2, column: 5 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b > 1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi . > │ 1i32 / 0i32 > │ ^ > │ "] })) / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b > 1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi' > │ 00:01:03 v #3221 Supervisor.buildFile / buildFileResult: > None > │ 00:01:03 v #3222 Supervisor.buildFile / ofSeqAsync / x: > (None, [], 0) > │ 00:01:03 v #3223 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [ > │ [ > │ "An attempt to divide by zero has been detected at > compile time.", > │ { > │ "TracedError": { > │ "message": "An attempt to divide by zero has been > detected at compile time.", > │ "trace": [ > │ "Error trace on line: 1, column: 10 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b > 1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi . > │ inl main () = > │ ^ > │ ", > │ "Error trace on line: 2, column: 5 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b > 1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi . > │ 1i32 / 0i32 > │ ^ > │ " > │ ] > │ } > │ } > │ ] > │ ] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b > 1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi > │ 00:01:03 v #3224 Supervisor.buildFile / outputChild / x: > Some > │ (Ok > │ (Some > │ (None, > │ [("An attempt to divide by zero has been detected at > compile time.", > │ TracedError > │ { message = > │ "An attempt to divide by zero has been > detected at compile time." > │ trace = > │ ["Error trace on line: 1, column: 10 in > module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b > 1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi . > │ inl main () = > │ ^ > │ "; > │ "Error trace on line: 2, column: 5 in > module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b > 1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi . > │ 1i32 / 0i32 > │ ^ > │ "] })], > │ 0))) > │ 00:01:03 v #3225 Supervisor.buildFile / ofSeqAsync / x: > (None, > │ [("An attempt to divide by zero has been detected at compile > time.", > │ TracedError > │ { message = > │ "An attempt to divide by zero has been detected at > compile time." > │ trace = > │ ["Error trace on line: 1, column: 10 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b > 1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi . > │ inl main () = > │ ^ > │ "; > │ "Error trace on line: 2, column: 5 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b > 1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi . > │ 1i32 / 0i32 > │ ^ > │ "] })], > │ 0) > │ 00:01:03 v #3226 Supervisor.buildFile / result: [("An > attempt to divide by zero has been detected at compile time.", > │ TracedError > │ { message = > │ "An attempt to divide by zero has been detected at > compile time." > │ trace = > │ ["Error trace on line: 1, column: 10 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b > 1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi . > │ inl main () = > │ ^ > │ "; > │ "Error trace on line: 2, column: 5 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b > 1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2/main.spi . > │ 1i32 / 0i32 > │ ^ > │ "] })] / buildFileResult: None / typeErrorCount: 0 > │ 00:01:03 v #3227 Supervisor.buildFile / retry: 0 / > typeErrorCount: 0 / fileDir: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/fef9812d9b06b75b > 1ab26589e52c6d6ff05910b73ead9e8c4f27f88d2a5cdfb2 / targetDir: > /home/runner/work/polyglot/polyglot/target > │ Some (None, ["An attempt to divide by zero has been detected > at compile time."]) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > SpiralTrace.TraceLevel.US0_0 |> set_trace_level > """ > inl main () = > real > inl unbox_real forall a. (obj : a) : a = > typecase obj with > | _ => obj > unbox_real () > () > """ > |> fun code -> Spi (code, None) > |> buildCode Fsharp [[||]] false 10000 None > |> Async.runWithTimeout 11000 > |> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> > List.map fst) > |> _assertEqual ( > Some ( > None, > [[ "Cannot apply a forall with a term." ]] > ) > ) > > ── [ 373.22ms - stdout ] ─────────────────────────────────────────────────────── > │ 00:01:03 v #3246 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi > │ 00:01:03 v #3247 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi' > │ 00:01:03 v #3248 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi > │ 00:01:03 v #3249 Supervisor.buildFile / fullPathUri: > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/66752865 > 9dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi" > │ 00:01:03 v #3250 Supervisor.buildFile / _fileOpenResult: > <null> > │ 00:01:03 v #3251 Supervisor.buildFile / before result: > () > │ 00:01:03 v #3486 Supervisor.buildFile / buildFileResult: > None > │ 00:01:03 v #3487 Supervisor.buildFile / ofSeqAsync / x: > (None, [], 0) > │ 00:01:03 v #3488 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: Some((Cannot apply a forall with a term., TracedError > │ { message = "Cannot apply a forall with a term." > │ trace = > │ ["Error trace on line: 2, column: 10 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl main () = > │ ^ > │ "; > │ "Error trace on line: 4, column: 9 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl unbox_real forall a. (obj : a) : a = > │ ^ > │ "; > │ "Error trace on line: 7, column: 9 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ unbox_real () > │ ^ > │ "] })) / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi' > │ 00:01:03 v #3489 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [ > │ [ > │ "Cannot apply a forall with a term.", > │ { > │ "TracedError": { > │ "message": "Cannot apply a forall with a term.", > │ "trace": [ > │ "Error trace on line: 2, column: 10 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl main () = > │ ^ > │ ", > │ "Error trace on line: 4, column: 9 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl unbox_real forall a. (obj : a) : a = > │ ^ > │ ", > │ "Error trace on line: 7, column: 9 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ unbox_real () > │ ^ > │ " > │ ] > │ } > │ } > │ ] > │ ] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi > │ 00:01:03 v #3491 Supervisor.buildFile / outputChild / x: > Some > │ (Ok > │ (Some > │ (None, > │ [("Cannot apply a forall with a term.", > │ TracedError > │ { message = "Cannot apply a forall with a term." > │ trace = > │ ["Error trace on line: 2, column: 10 in > module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl main () = > │ ^ > │ "; > │ "Error trace on line: 4, column: 9 in > module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl unbox_real forall a. (obj : a) : a = > │ ^ > │ "; > │ "Error trace on line: 7, column: 9 in > module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ unbox_real () > │ ^ > │ "] })], > │ 0))) > │ 00:01:03 v #3492 Supervisor.buildFile / ofSeqAsync / x: > (None, > │ [("Cannot apply a forall with a term.", > │ TracedError > │ { message = "Cannot apply a forall with a term." > │ trace = > │ ["Error trace on line: 2, column: 10 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl main () = > │ ^ > │ "; > │ "Error trace on line: 4, column: 9 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl unbox_real forall a. (obj : a) : a = > │ ^ > │ "; > │ "Error trace on line: 7, column: 9 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ unbox_real () > │ ^ > │ "] })], > │ 0) > │ 00:01:03 v #3493 Supervisor.buildFile / result: > [("Cannot apply a forall with a term.", > │ TracedError > │ { message = "Cannot apply a forall with a term." > │ trace = > │ ["Error trace on line: 2, column: 10 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl main () = > │ ^ > │ "; > │ "Error trace on line: 4, column: 9 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl unbox_real forall a. (obj : a) : a = > │ ^ > │ "; > │ "Error trace on line: 7, column: 9 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ unbox_real () > │ ^ > │ "] })] / buildFileResult: None / typeErrorCount: 0 > │ 00:01:03 v #3494 Supervisor.buildFile / retry: 0 / > typeErrorCount: 0 / fileDir: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a / targetDir: > /home/runner/work/polyglot/polyglot/target > │ Some (None, ["Cannot apply a forall with a term."]) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > SpiralTrace.TraceLevel.US0_0 |> set_trace_level > """ > inl main () = > real > inl unbox_real forall a. (obj : a) : a = > typecase obj with > | _ => obj > unbox_real `i32 1 > """ > |> fun code -> Spi (code, None) > |> buildCode Fsharp [[||]] false 10000 None > |> Async.runWithTimeout 11000 > |> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> > List.map fst) > |> _assertEqual ( > Some ( > None, > [[ "The main function should not have a forall." ]] > ) > ) > > ── [ 373.17ms - stdout ] ─────────────────────────────────────────────────────── > │ 00:01:03 v #3512 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b79 > 0acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi > │ 00:01:03 v #3513 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b79 > 0acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi' > │ 00:01:03 v #3514 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b79 > 0acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi > │ 00:01:03 v #3515 Supervisor.buildFile / fullPathUri: > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42 > df309b790acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi" > │ 00:01:03 v #3516 Supervisor.buildFile / _fileOpenResult: > <null> > │ 00:01:03 v #3517 Supervisor.buildFile / before result: > () > │ 00:01:03 v #3754 Supervisor.buildFile / buildFileResult: > None > │ 00:01:03 v #3755 Supervisor.buildFile / ofSeqAsync / x: > (None, [], 0) > │ 00:01:03 v #3756 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: Some((The main function should not have a forall., TracedError > { message = "The main function should not have a forall." > │ trace = [] })) / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b79 > 0acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi' > │ 00:01:03 v #3757 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [ > │ [ > │ "The main function should not have a forall.", > │ { > │ "TracedError": { > │ "message": "The main function should not have a > forall.", > │ "trace": [] > │ } > │ } > │ ] > │ ] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b79 > 0acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f/main.spi > │ 00:01:03 v #3759 Supervisor.buildFile / outputChild / x: > Some > │ (Ok > │ (Some > │ (None, > │ [("The main function should not have a forall.", > │ TracedError { message = "The main function should > not have a forall." > │ trace = [] })], 0))) > │ 00:01:03 v #3760 Supervisor.buildFile / ofSeqAsync / x: > (None, > │ [("The main function should not have a forall.", > │ TracedError { message = "The main function should not have > a forall." > │ trace = [] })], 0) > │ 00:01:03 v #3761 Supervisor.buildFile / result: [("The > main function should not have a forall.", > │ TracedError { message = "The main function should not have > a forall." > │ trace = [] })] / buildFileResult: None / > typeErrorCount: 0 > │ 00:01:03 v #3762 Supervisor.buildFile / retry: 0 / > typeErrorCount: 0 / fileDir: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/0ba44c42df309b79 > 0acdf4f9fc55fcc7912380f5dd2d90fad118bad793251c4f / targetDir: > /home/runner/work/polyglot/polyglot/target > │ Some (None, ["The main function should not have a forall."]) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > SpiralTrace.TraceLevel.US0_0 |> set_trace_level > """ > inl main () = > real > inl unbox_real forall a. (obj : a) : a = > typecase obj with > | _ => obj > unbox_real () > () > """ > |> fun code -> Spi (code, None) > |> buildCode Fsharp [[||]] false 10000 None > |> Async.runWithTimeout 11000 > |> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> > List.map fst) > |> _assertEqual ( > Some ( > None, > [[ "Cannot apply a forall with a term." ]] > ) > ) > > ── [ 333.30ms - stdout ] ─────────────────────────────────────────────────────── > │ 00:01:04 v #3780 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi > │ 00:01:04 v #3781 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi' > │ 00:01:04 v #3782 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi > │ 00:01:04 v #3783 Supervisor.buildFile / fullPathUri: > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/66752865 > 9dc2e5af51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi" > │ 00:01:04 v #3784 Supervisor.buildFile / _fileOpenResult: > <null> > │ 00:01:04 v #3785 Supervisor.buildFile / before result: > () > │ 00:01:04 v #4022 Supervisor.buildFile / buildFileResult: > None > │ 00:01:04 v #4023 Supervisor.buildFile / ofSeqAsync / x: > (None, [], 0) > │ 00:01:04 v #4024 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: Some((Cannot apply a forall with a term., TracedError > │ { message = "Cannot apply a forall with a term." > │ trace = > │ ["Error trace on line: 2, column: 10 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl main () = > │ ^ > │ "; > │ "Error trace on line: 4, column: 9 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl unbox_real forall a. (obj : a) : a = > │ ^ > │ "; > │ "Error trace on line: 7, column: 9 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ unbox_real () > │ ^ > │ "] })) / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi' > │ 00:01:04 v #4025 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [ > │ [ > │ "Cannot apply a forall with a term.", > │ { > │ "TracedError": { > │ "message": "Cannot apply a forall with a term.", > │ "trace": [ > │ "Error trace on line: 2, column: 10 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl main () = > │ ^ > │ ", > │ "Error trace on line: 4, column: 9 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl unbox_real forall a. (obj : a) : a = > │ ^ > │ ", > │ "Error trace on line: 7, column: 9 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ unbox_real () > │ ^ > │ " > │ ] > │ } > │ } > │ ] > │ ] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi > │ 00:01:04 v #4027 Supervisor.buildFile / outputChild / x: > Some > │ (Ok > │ (Some > │ (None, > │ [("Cannot apply a forall with a term.", > │ TracedError > │ { message = "Cannot apply a forall with a term." > │ trace = > │ ["Error trace on line: 2, column: 10 in > module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl main () = > │ ^ > │ "; > │ "Error trace on line: 4, column: 9 in > module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl unbox_real forall a. (obj : a) : a = > │ ^ > │ "; > │ "Error trace on line: 7, column: 9 in > module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ unbox_real () > │ ^ > │ "] })], > │ 0))) > │ 00:01:04 v #4028 Supervisor.buildFile / ofSeqAsync / x: > (None, > │ [("Cannot apply a forall with a term.", > │ TracedError > │ { message = "Cannot apply a forall with a term." > │ trace = > │ ["Error trace on line: 2, column: 10 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl main () = > │ ^ > │ "; > │ "Error trace on line: 4, column: 9 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl unbox_real forall a. (obj : a) : a = > │ ^ > │ "; > │ "Error trace on line: 7, column: 9 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ unbox_real () > │ ^ > │ "] })], > │ 0) > │ 00:01:04 v #4029 Supervisor.buildFile / result: > [("Cannot apply a forall with a term.", > │ TracedError > │ { message = "Cannot apply a forall with a term." > │ trace = > │ ["Error trace on line: 2, column: 10 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl main () = > │ ^ > │ "; > │ "Error trace on line: 4, column: 9 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ inl unbox_real forall a. (obj : a) : a = > │ ^ > │ "; > │ "Error trace on line: 7, column: 9 in module: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a/main.spi . > │ unbox_real () > │ ^ > │ "] })] / buildFileResult: None / typeErrorCount: 0 > │ 00:01:04 v #4030 Supervisor.buildFile / retry: 0 / > typeErrorCount: 0 / fileDir: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/667528659dc2e5af > 51a6ec17f1774bd7ffff5b5a47e4e117eec78e740987f29a / targetDir: > /home/runner/work/polyglot/polyglot/target > │ Some (None, ["Cannot apply a forall with a term."]) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > SpiralTrace.TraceLevel.US0_0 |> set_trace_level > """inl main () = > 1 + "" > """ > |> fun code -> Spi (code, None) > |> buildCode Fsharp [[||]] false 10000 None > |> Async.runWithTimeout 11000 > |> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> > List.map fst) > |> _assertEqual ( > Some ( > None, > [[ > "main.spi: > Constraint satisfaction error. > Got: string > Fails to satisfy: number" > ]] > ) > ) > > ── [ 266.90ms - stdout ] ─────────────────────────────────────────────────────── > │ 00:01:04 v #4049 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553bef > cbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi > │ 00:01:04 v #4050 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553bef > cbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi' > │ 00:01:04 v #4051 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553bef > cbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi > │ 00:01:04 v #4052 Supervisor.buildFile / fullPathUri: > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f > 8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi" > │ 00:01:04 v #4053 Supervisor.buildFile / _fileOpenResult: > <null> > │ 00:01:04 v #4054 Supervisor.buildFile / before result: > () > │ 00:01:04 v #4134 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: Some((main.spi: > │ Constraint satisfaction error. > │ Got: string > │ Fails to satisfy: number, TypeErrors > │ { errors = > │ [(({ character = 8 > │ line = 1 }, { character = 10 > │ line = 1 }), > │ "Constraint satisfaction error. > │ Got: string > │ Fails to satisfy: number")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f > 8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi" })) / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553bef > cbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi' > │ 00:01:04 v #4138 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [ > │ [ > │ "main.spi: > │ Constraint satisfaction error. > │ Got: string > │ Fails to satisfy: number", > │ { > │ "TypeErrors": { > │ "errors": [ > │ [ > │ [ > │ { > │ "character": 8, > │ "line": 1 > │ }, > │ { > │ "character": 10, > │ "line": 1 > │ } > │ ], > │ "Constraint satisfaction error. > │ Got: string > │ Fails to satisfy: number" > │ ] > │ ], > │ "uri": > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f > 8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi" > │ } > │ } > │ ] > │ ] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553bef > cbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi > │ 00:01:04 v #4144 Supervisor.buildFile / outputContentSeq > unfoldAsync / msg: (None, > │ Some > │ ("main.spi: > │ Constraint satisfaction error. > │ Got: string > │ Fails to satisfy: number", > │ TypeErrors > │ { errors = > │ [(({ character = 8 > │ line = 1 }, { character = 10 > │ line = 1 }), > │ "Constraint satisfaction error. > │ Got: string > │ Fails to satisfy: number")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f > 8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi" })) > │ 00:01:04 v #4146 Supervisor.buildFile / > takeWhileInclusive / TypeErrors trigger > │ 00:01:04 v #4152 Supervisor.buildFile / outputChild / x: > Some > │ (Ok > │ (Some > │ (None, > │ [("main.spi: > │ Constraint satisfaction error. > │ Got: string > │ Fails to satisfy: number", > │ TypeErrors > │ { errors = > │ [(({ character = 8 > │ line = 1 }, { character = 10 > │ line = 1 }), > │ "Constraint satisfaction error. > │ Got: string > │ Fails to satisfy: number")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f > 8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi" })], > │ 0))) > │ 00:01:04 v #4154 Supervisor.buildFile / outputChild |> > Async.map > │ 00:01:04 v #4158 Supervisor.buildFile / > outputContentSeq2 unfoldAsync / msg: (None, > │ [("main.spi: > │ Constraint satisfaction error. > │ Got: string > │ Fails to satisfy: number", > │ TypeErrors > │ { errors = > │ [(({ character = 8 > │ line = 1 }, { character = 10 > │ line = 1 }), > │ "Constraint satisfaction error. > │ Got: string > │ Fails to satisfy: number")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f > 8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi" })], > │ 0) > │ 00:01:04 v #4162 Supervisor.buildFile / ofSeqAsync / x: > (None, > │ [("main.spi: > │ Constraint satisfaction error. > │ Got: string > │ Fails to satisfy: number", > │ TypeErrors > │ { errors = > │ [(({ character = 8 > │ line = 1 }, { character = 10 > │ line = 1 }), > │ "Constraint satisfaction error. > │ Got: string > │ Fails to satisfy: number")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f > 8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi" })], > │ 0) > │ 00:01:04 v #4166 Supervisor.buildFile / result: > [("main.spi: > │ Constraint satisfaction error. > │ Got: string > │ Fails to satisfy: number", > │ TypeErrors > │ { errors = > │ [(({ character = 8 > │ line = 1 }, { character = 10 > │ line = 1 }), > │ "Constraint satisfaction error. > │ Got: string > │ Fails to satisfy: number")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f > 8e553befcbdd9aabeace67685221d91a46e3655199e42df713504aa0/main.spi" })] / > buildFileResult: None / typeErrorCount: 0 > │ 00:01:04 v #4167 Supervisor.buildFile / retry: 0 / > typeErrorCount: 0 / fileDir: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/c030f84f8e553bef > cbdd9aabeace67685221d91a46e3655199e42df713504aa0 / targetDir: > /home/runner/work/polyglot/polyglot/target > │ 00:01:04 v #4172 Supervisor.buildFile / outputChild |> > Async.map > │ Some (None, ["main.spi: > │ Constraint satisfaction error. > │ Got: string > │ Fails to satisfy: number"]) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > SpiralTrace.TraceLevel.US0_0 |> set_trace_level > """inl main () = > x + y > """ > |> fun code -> Spi (code, None) > |> buildCode Fsharp [[||]] false 10000 None > |> Async.runWithTimeout 11000 > |> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> > List.map fst) > |> _assertEqual ( > Some ( > None, > [[ > "main.spi: > Unbound variable: x. > Unbound variable: y." > ]] > ) > ) > > ── [ 256.44ms - stdout ] ─────────────────────────────────────────────────────── > │ 00:01:04 v #4320 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba > 9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi > │ 00:01:04 v #4321 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba > 9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi' > │ 00:01:04 v #4322 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba > 9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi > │ 00:01:04 v #4323 Supervisor.buildFile / fullPathUri: > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec50 > 7f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi" > │ 00:01:04 v #4324 Supervisor.buildFile / _fileOpenResult: > <null> > │ 00:01:04 v #4325 Supervisor.buildFile / before result: > () > │ 00:01:04 v #4365 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: Some((main.spi: > │ Unbound variable: x. > │ Unbound variable: y., TypeErrors > │ { errors = > │ [(({ character = 4 > │ line = 1 }, { character = 5 > │ line = 1 }), "Unbound variable: x."); > │ (({ character = 8 > │ line = 1 }, { character = 9 > │ line = 1 }), "Unbound variable: y.")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec50 > 7f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi" })) / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba > 9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi' > │ 00:01:04 v #4366 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [ > │ [ > │ "main.spi: > │ Unbound variable: x. > │ Unbound variable: y.", > │ { > │ "TypeErrors": { > │ "errors": [ > │ [ > │ [ > │ { > │ "character": 4, > │ "line": 1 > │ }, > │ { > │ "character": 5, > │ "line": 1 > │ } > │ ], > │ "Unbound variable: x." > │ ], > │ [ > │ [ > │ { > │ "character": 8, > │ "line": 1 > │ }, > │ { > │ "character": 9, > │ "line": 1 > │ } > │ ], > │ "Unbound variable: y." > │ ] > │ ], > │ "uri": > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec50 > 7f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi" > │ } > │ } > │ ] > │ ] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba > 9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi > │ 00:01:04 v #4370 Supervisor.buildFile / outputContentSeq > unfoldAsync / msg: (None, > │ Some > │ ("main.spi: > │ Unbound variable: x. > │ Unbound variable: y.", > │ TypeErrors > │ { errors = > │ [(({ character = 4 > │ line = 1 }, { character = 5 > │ line = 1 }), "Unbound variable: > x."); > │ (({ character = 8 > │ line = 1 }, { character = 9 > │ line = 1 }), "Unbound variable: > y.")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec50 > 7f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi" })) > │ 00:01:04 v #4372 Supervisor.buildFile / > takeWhileInclusive / TypeErrors trigger > │ 00:01:04 v #4377 Supervisor.buildFile / outputChild / x: > Some > │ (Ok > │ (Some > │ (None, > │ [("main.spi: > │ Unbound variable: x. > │ Unbound variable: y.", > │ TypeErrors > │ { errors = > │ [(({ character = 4 > │ line = 1 }, { character = 5 > │ line = 1 }), "Unbound > variable: x."); > │ (({ character = 8 > │ line = 1 }, { character = 9 > │ line = 1 }), "Unbound > variable: y.")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec50 > 7f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi" })], > │ 0))) > │ 00:01:04 v #4378 Supervisor.buildFile / outputChild |> > Async.map > │ 00:01:04 v #4381 Supervisor.buildFile / > outputContentSeq2 unfoldAsync / msg: (None, > │ [("main.spi: > │ Unbound variable: x. > │ Unbound variable: y.", > │ TypeErrors > │ { errors = > │ [(({ character = 4 > │ line = 1 }, { character = 5 > │ line = 1 }), "Unbound variable: > x."); > │ (({ character = 8 > │ line = 1 }, { character = 9 > │ line = 1 }), "Unbound variable: > y.")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec50 > 7f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi" })], > │ 0) > │ 00:01:04 v #4384 Supervisor.buildFile / ofSeqAsync / x: > (None, > │ [("main.spi: > │ Unbound variable: x. > │ Unbound variable: y.", > │ TypeErrors > │ { errors = > │ [(({ character = 4 > │ line = 1 }, { character = 5 > │ line = 1 }), "Unbound variable: > x."); > │ (({ character = 8 > │ line = 1 }, { character = 9 > │ line = 1 }), "Unbound variable: > y.")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec50 > 7f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi" })], > │ 0) > │ 00:01:04 v #4387 Supervisor.buildFile / result: > [("main.spi: > │ Unbound variable: x. > │ Unbound variable: y.", > │ TypeErrors > │ { errors = > │ [(({ character = 4 > │ line = 1 }, { character = 5 > │ line = 1 }), "Unbound variable: > x."); > │ (({ character = 8 > │ line = 1 }, { character = 9 > │ line = 1 }), "Unbound variable: > y.")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec50 > 7f9de5ba9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1/main.spi" })] / > buildFileResult: None / typeErrorCount: 0 > │ 00:01:04 v #4388 Supervisor.buildFile / retry: 0 / > typeErrorCount: 0 / fileDir: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/6cdeec507f9de5ba > 9c8429cfa7049b777a622aa3bf7333b151c767fde35dc5d1 / targetDir: > /home/runner/work/polyglot/polyglot/target > │ 00:01:04 v #4390 Supervisor.buildFile / outputChild |> > Async.map > │ Some (None, ["main.spi: > │ Unbound variable: x. > │ Unbound variable: y."]) > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > SpiralTrace.TraceLevel.US0_0 |> set_trace_level > """inl rec main () = main""" > |> fun code -> Spi (code, None) > |> buildCode Fsharp [[||]] false 10000 None > |> Async.runWithTimeout 11000 > |> Option.map (fun (_, (_, outputContent), errors) -> outputContent, errors |> > List.map fst) > |> _assertEqual ( > Some ( > None, > [[ > "main.spi: > Recursive metavariables are not allowed. A metavar cannot be unified with a type > that has itself. > Got: 'a > Expected: () -> 'a" > ]] > ) > ) > // |> _assertEqual None > // |> fun x -> printfn $"{x.ToDisplayString ()}" > > ── [ 254.24ms - stdout ] ─────────────────────────────────────────────────────── > │ 00:01:05 v #4590 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/883e0123fe6304a9 > 501da46e85facc39c4ac4e3dbb77895f8ccd4581901ee2b7/main.spi > │ 00:01:05 v #4591 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/883e0123fe6304a9 > 501da46e85facc39c4ac4e3dbb77895f8ccd4581901ee2b7/main.spi' > │ 00:01:05 v #4592 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/883e0123fe6304a9 > 501da46e85facc39c4ac4e3dbb77895f8ccd4581901ee2b7/main.spi > │ 00:01:05 v #4593 Supervisor.buildFile / fullPathUri: > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/883e0123 > fe6304a9501da46e85facc39c4ac4e3dbb77895f8ccd4581901ee2b7/main.spi" > │ 00:01:05 v #4594 Supervisor.buildFile / _fileOpenResult: > <null> > │ 00:01:05 v #4595 Supervisor.buildFile / before result: > () > │ 00:01:05 v #4636 Supervisor.buildFile / AsyncSeq.scan / > outputContent: > │ ' / errors: [] / outputContentResult: / typeErrorCount: 0 / > retry: 0 / error: Some((main.spi: > │ Recursive metavariables are not allowed. A metavar cannot be > unified with a type that has itself. > │ Got: 'a > │ Expected: () -> 'a, TypeErrors > │ { errors = > │ [(({ character = 18 > │ line = 0 }, { character = 22 > │ line = 0 }), > │ "Recursive metavariables are not allowed. A metavar > cannot be unified with a type that has itself. > │ Got: 'a > │ Expected: () -> 'a")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/883e0123 > fe6304a9501da46e85facc39c4ac4e3dbb77895f8ccd4581901ee2b7/main.spi" })) / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/883e0123fe6304a9 > 501da46e85facc39c4ac4e3dbb77895f8ccd4581901ee2b7/main.spi' > │ 00:01:05 v #4638 Supervisor.buildFile / > takeWhileInclusive / outputContent: > │ '' / errors: [ > │ [ > │ "main.spi: > │ Recursive metavariables are not allowed. A metavar cannot be > unified with a type that has itself. > │ Got: 'a > │ Expected: () -> 'a", > │ { > │ "TypeErrors": { > │ "errors": [ > │ [ > │ [ > │ { > │ "character": 18, > │ "line": 0 > │ }, > │ { > │ "character": 22, > │ "line": 0 > │ } > │ ], > │ "Recursive metavariables are not allowed. A > metavar cannot be unified with a type that has itself. > │ Got: 'a > │ Expected: () -> 'a" > │ ] > │ ], > │ "uri": > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/883e0123 > fe6304a9501da46e85facc39c4ac4e3dbb77895f8ccd4581901ee2b7/main.spi" > │ } > │ } > │ ] > │ ] / typeErrorCount: 0 / retry: 0 / path: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/883e0123fe6304a9 > 501da46e85facc39c4ac4e3dbb77895f8ccd4581901ee2b7/main.spi > │ 00:01:05 v #4640 Supervisor.buildFile / outputContentSeq > unfoldAsync / msg: (None, > │ Some > │ ("main.spi: > │ Recursive metavariables are not allowed. A metavar cannot be > unified with a type that has itself. > │ Got: 'a > │ Expected: () -> 'a", > │ TypeErrors > │ { errors = > │ [(({ character = 18 > │ line = 0 }, { character = 22 > │ line = 0 }), > │ "Recursive metavariables are not allowed. A > metavar cannot be unified with a type that has itself. > │ Got: 'a > │ Expected: () -> 'a")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/883e0123 > fe6304a9501da46e85facc39c4ac4e3dbb77895f8ccd4581901ee2b7/main.spi" })) > │ 00:01:05 v #4641 Supervisor.buildFile / > takeWhileInclusive / TypeErrors trigger > │ 00:01:05 v #4646 Supervisor.buildFile / outputChild / x: > Some > │ (Ok > │ (Some > │ (None, > │ [("main.spi: > │ Recursive metavariables are not allowed. A metavar cannot be > unified with a type that has itself. > │ Got: 'a > │ Expected: () -> 'a", > │ TypeErrors > │ { errors = > │ [(({ character = 18 > │ line = 0 }, { character = 22 > │ line = 0 }), > │ "Recursive metavariables are not allowed. A > metavar cannot be unified with a type that has itself. > │ Got: 'a > │ Expected: () -> 'a")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/883e0123 > fe6304a9501da46e85facc39c4ac4e3dbb77895f8ccd4581901ee2b7/main.spi" })], > │ 0))) > │ 00:01:05 v #4647 Supervisor.buildFile / outputChild |> > Async.map > │ 00:01:05 v #4649 Supervisor.buildFile / > outputContentSeq2 unfoldAsync / msg: (None, > │ [("main.spi: > │ Recursive metavariables are not allowed. A metavar cannot be > unified with a type that has itself. > │ Got: 'a > │ Expected: () -> 'a", > │ TypeErrors > │ { errors = > │ [(({ character = 18 > │ line = 0 }, { character = 22 > │ line = 0 }), > │ "Recursive metavariables are not allowed. A metavar > cannot be unified with a type that has itself. > │ Got: 'a > │ Expected: () -> 'a")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/883e0123 > fe6304a9501da46e85facc39c4ac4e3dbb77895f8ccd4581901ee2b7/main.spi" })], > │ 0) > │ 00:01:05 v #4652 Supervisor.buildFile / ofSeqAsync / x: > (None, > │ [("main.spi: > │ Recursive metavariables are not allowed. A metavar cannot be > unified with a type that has itself. > │ Got: 'a > │ Expected: () -> 'a", > │ TypeErrors > │ { errors = > │ [(({ character = 18 > │ line = 0 }, { character = 22 > │ line = 0 }), > │ "Recursive metavariables are not allowed. A metavar > cannot be unified with a type that has itself. > │ Got: 'a > │ Expected: () -> 'a")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/883e0123 > fe6304a9501da46e85facc39c4ac4e3dbb77895f8ccd4581901ee2b7/main.spi" })], > │ 0) > │ 00:01:05 v #4654 Supervisor.buildFile / result: > [("main.spi: > │ Recursive metavariables are not allowed. A metavar cannot be > unified with a type that has itself. > │ Got: 'a > │ Expected: () -> 'a", > │ TypeErrors > │ { errors = > │ [(({ character = 18 > │ line = 0 }, { character = 22 > │ line = 0 }), > │ "Recursive metavariables are not allowed. A metavar > cannot be unified with a type that has itself. > │ Got: 'a > │ Expected: () -> 'a")] > │ uri = > │ > "file:///home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/883e0123 > fe6304a9501da46e85facc39c4ac4e3dbb77895f8ccd4581901ee2b7/main.spi" })] / > buildFileResult: None / typeErrorCount: 0 > │ 00:01:05 v #4655 Supervisor.buildFile / retry: 0 / > typeErrorCount: 0 / fileDir: > /home/runner/work/polyglot/polyglot/target/spiral_Eval/packages/883e0123fe6304a9 > 501da46e85facc39c4ac4e3dbb77895f8ccd4581901ee2b7 / targetDir: > /home/runner/work/polyglot/polyglot/target > │ 00:01:05 v #4657 Supervisor.buildFile / outputChild |> > Async.map > │ Some > │ (None, > │ ["main.spi: > │ Recursive metavariables are not allowed. A metavar cannot be > unified with a type that has itself. > │ Got: 'a > │ Expected: () -> 'a"]) > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## getFileTokenRange > > ── fsharp ────────────────────────────────────────────────────────────────────── > let getFileTokenRange port cancellationToken path = async { > let fullPath = path |> System.IO.Path.GetFullPath > let codeDir = fullPath |> System.IO.Path.GetDirectoryName > let tokensPath = codeDir </> "tokens.json" > let! tokens = async { > if tokensPath |> System.IO.File.Exists |> not > then return None > else > let! text = tokensPath |> SpiralFileSystem.read_all_text_async > > return > if text.Length > 2 > then text |> FSharp.Json.Json.deserialize<int array> |> Some > else None > } > > match tokens with > | Some tokens -> > return tokens |> Some > | None -> > let! code = fullPath |> SpiralFileSystem.read_all_text_async > let lines = code |> SpiralSm.split "\n" > > let struct (token, disposable) = SpiralThreading.new_disposable_token > cancellationToken > use _ = disposable > > let port = port |> Option.defaultWith getCompilerPort > // let! serverPort, _errors, ct, disposable = awaitCompiler port (Some > token) > // use _ = disposable > > let fullPathUri = fullPath |> SpiralFileSystem.normalize_path |> > SpiralFileSystem.new_file_uri > > // let fileOpenObj = {| FileOpen = {| uri = fullPathUri; spiText = code > |} |} > // let! _fileOpenResult = fileOpenObj |> sendObj serverPort > let fileOpenArgs = {| uri = fullPathUri; spiText = code |} > let! _fileOpenResult = > server2.job_null (server2.supervisor *<+ SupervisorReq.FileOpen > fileOpenArgs) > |> Async.AwaitTask > > // do! Async.Sleep 60 > > let fileTokenRangeArgs = > {| > uri = fullPathUri > range = > {| > line = 0 > character = 0 > |}, > {| > line = lines.Length - 1 > character = lines.[[lines.Length - 1]].Length > |} > |} > // let! fileTokenRangeResult = > // fileTokenRangeObj > // |> sendObj serverPort > // |> Async.withCancellationToken ct > > // let fileTokenRangeArgs = {| uri = fullPathUri; backend = backendId |} > let! fileTokenRangeResult = > server2.job_val (fun res -> server2.supervisor *<+ > SupervisorReq.FileTokenRange(fileTokenRangeArgs,res)) > |> Async.AwaitTask > > if codeDir |> SpiralSm.starts_with (workspaceRoot </> "target") then > let fileDirUri = codeDir |> SpiralFileSystem.normalize_path |> > SpiralFileSystem.new_file_uri > // let fileDeleteObj = {| FileDelete = {| uris = [[| fileDirUri |]] > |} |} > // let! _fileDeleteResult = fileDeleteObj |> sendObj serverPort > let fileDeleteArgs = {| uris = [[| fileDirUri |]] |} > let! _fileDeleteResult = > server2.job_null (server2.supervisor *<+ > SupervisorReq.FileDelete fileDeleteArgs) > |> Async.AwaitTask > () > > return fileTokenRangeResult |> FSharp.Json.Json.deserialize<int array> > |> Some > } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## getCodeTokenRange > > ── fsharp ────────────────────────────────────────────────────────────────────── > let getCodeTokenRange cancellationToken code = async { > let! mainPath, _ = > persistCode {| input = Spi (code, None); backend = None; packages = > [[||]] |} > return! mainPath |> getFileTokenRange None cancellationToken > } > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > """inl main () = ()""" > |> getCodeTokenRange None > |> Async.runWithTimeout 10000 > |> Option.flatten > |> _assertEqual (Some [[| 0; 0; 3; 7; 0; 0; 4; 4; 0; 0; 0; 5; 1; 8; 0; 0; 1; 1; > 8; 0; 0; 2; 1; 4; 0; 0; > 2; 1; 8; 0; 0; 1; 1; 8; 0 |]]) > > ── [ 527.67ms - stdout ] ─────────────────────────────────────────────────────── > │ Some [|0; 0; 3; 7; 0; 0; 4; 4; 0; 0; 0; 5; 1; 8; 0; 0; 1; 1; > 8; 0; 0; 2; 1; 4; 0; 0; 2; 1; 8; 0; 0; 1; 1; 8; 0|] > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > """inl main () = 1i32""" > |> getCodeTokenRange None > |> Async.runWithTimeout 10000 > |> Option.flatten > |> _assertEqual (Some [[| 0; 0; 3; 7; 0; 0; 4; 4; 0; 0; 0; 5; 1; 8; 0; 0; 1; 1; > 8; 0; 0; 2; 1; 4; 0; 0; > 2; 1; 3; 0; 0; 1; 3; 12; 0 |]]) > > ── [ 1.52s - stdout ] ────────────────────────────────────────────────────────── > │ Some [|0; 0; 3; 7; 0; 0; 4; 4; 0; 0; 0; 5; 1; 8; 0; 0; 1; 1; > 8; 0; 0; 2; 1; 4; 0; 0; 2; 1; 3; 0; 0; 1; 3; 12; 0|] > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## getFileHoverAt > > ── fsharp ────────────────────────────────────────────────────────────────────── > let getFileHoverAt > port > cancellationToken > path > (position : {| line: int; character: int |}) > = async { > let fullPath = path |> System.IO.Path.GetFullPath > let! code = fullPath |> SpiralFileSystem.read_all_text_async > let lines = code |> SpiralSm.split "\n" > > let struct (token, disposable) = SpiralThreading.new_disposable_token > cancellationToken > use _ = disposable > > let port = port |> Option.defaultWith getCompilerPort > // let! serverPort, _errors, ct, disposable = awaitCompiler port (Some > token) > // use _ = disposable > > let fullPathUri = fullPath |> SpiralFileSystem.normalize_path |> > SpiralFileSystem.new_file_uri > > // let fileOpenObj = {| FileOpen = {| uri = fullPathUri; spiText = code |} > |} > // let! _fileOpenResult = fileOpenObj |> sendObj serverPort > let fileOpenArgs = {| uri = fullPathUri; spiText = code |} > let! _fileOpenResult = > server1.job_null (server1.supervisor *<+ SupervisorReq.FileOpen > fileOpenArgs) > |> Async.AwaitTask > > // do! Async.Sleep 60 > > let hoverAtArgs = > {| > uri = fullPathUri > pos = position > |} > > let! hoverAtResult = > server1.job_val (fun res -> server1.supervisor *<+ > SupervisorReq.HoverAt(hoverAtArgs,res)) > |> Async.AwaitTask > > let fileDir = fullPath |> System.IO.Path.GetDirectoryName > if fileDir |> SpiralSm.starts_with (workspaceRoot </> "target") then > let fileDirUri = fileDir |> SpiralFileSystem.normalize_path |> > SpiralFileSystem.new_file_uri > // let fileDeleteObj = {| FileDelete = {| uris = [[| fileDirUri |]] |} > |} > // let! _fileDeleteResult = fileDeleteObj |> sendObj serverPort > let fileDeleteArgs = {| uris = [[| fileDirUri |]] |} > let! _fileDeleteResult = > server1.job_null (server1.supervisor *<+ SupervisorReq.FileDelete > fileDeleteArgs) > |> Async.AwaitTask > |> Async.runWithTimeoutAsync 60000 > |> Async.map Option.get > () > > return hoverAtResult |> Some > } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## getCodeHoverAt > > ── fsharp ────────────────────────────────────────────────────────────────────── > let getCodeHoverAt cancellationToken code position = async { > let! mainPath, _ = > persistCode {| input = Spi (code, None); backend = None; packages = > [[||]] |} > > let codeDir = mainPath |> System.IO.Path.GetDirectoryName > let filePath = codeDir </> "hover.json" > let! output = async { > if filePath |> System.IO.File.Exists |> not > then return None > else > let! text = filePath |> SpiralFileSystem.read_all_text_async > > return > if text.Length > 2 > then text |> Some > else None > } > match output with > | Some output -> > return output |> Some > | None -> return! getFileHoverAt None cancellationToken mainPath position > } > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > getCodeHoverAt None """inl main () = ()""" {| line = 0; character = 4 |} > |> Async.runWithTimeout 10000 > |> Option.flatten > |> _assertEqual (Some "() -> ()") > > ── [ 206.34ms - stdout ] ─────────────────────────────────────────────────────── > │ Some "() -> ()" > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > getCodeHoverAt None """inl main () = ()""" {| line = 0; character = 0 |} > |> Async.runWithTimeout 10000 > |> Option.flatten > |> _assertEqual (Some null) > > ── [ 191.89ms - stdout ] ─────────────────────────────────────────────────────── > │ Some null > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > getCodeHoverAt None """inl rec main () = main""" {| line = 0; character = 8 |} > |> Async.runWithTimeout 10000 > |> Option.flatten > |> _assertEqual (Some "forall 'a. () -> 'a") > > ── [ 191.49ms - stdout ] ─────────────────────────────────────────────────────── > │ Some "forall 'a. () -> 'a" > │ > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > getCodeHoverAt None """inl main () = 1""" {| line = 0; character = 4 |} > |> Async.runWithTimeout 10000 > |> Option.flatten > |> _assertEqual (Some "forall 'a {number}. () -> 'a") > > ── [ 193.75ms - stdout ] ─────────────────────────────────────────────────────── > │ Some "forall 'a {number}. () -> 'a" > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## Arguments > > ── fsharp ────────────────────────────────────────────────────────────────────── > [[<RequireQualifiedAccess>]] > type Arguments = > | Build_File of string * string > | File_Token_Range of string * string > | File_Hover_At of string * string * int * int > | Execute_Command of string > | [[<Argu.ArguAttributes.Unique>]] Timeout of int > | [[<Argu.ArguAttributes.Unique>]] Port of int > | [[<Argu.ArguAttributes.Unique>]] Parallel > | [[<Argu.ArguAttributes.Unique>]] Exit_On_Error > > interface Argu.IArgParserTemplate with > member s.Usage = > match s with > | Build_File _ -> nameof Build_File > | File_Token_Range _ -> nameof File_Token_Range > | File_Hover_At _ -> nameof File_Hover_At > | Execute_Command _ -> nameof Execute_Command > | Timeout _ -> nameof Timeout > | Port _ -> nameof Port > | Parallel -> nameof Parallel > | Exit_On_Error-> nameof Exit_On_Error > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > Argu.ArgumentParser.Create<Arguments>().PrintUsage () > > ── [ 82.44ms - return value ] ────────────────────────────────────────────────── > │ "USAGE: dotnet-repl [--help] [--build-file <string> <string>] > │ [--file-token-range <string> <string>] > │ [--file-hover-at <string> <string> <int> > <int>] > │ [--execute-command <string>] [--timeout > <int>] [--port <int>] > │ [--parallel] [--exit-on-error] > │ > │ OPTIONS: > │ > │ --build-file <string> <string> > │ Build_File > │ --file-token-range <string> <string> > │ File_Token_Range > │ --file-hover-at <string> <string> <int> <int> > │ File_Hover_At > │ --execute-command <string> > │ Execute_Command > │ --timeout <int> Timeout > │ --port <int> Port > │ --parallel Parallel > │ --exit-on-error Exit_On_Error > │ --help display this list of options. > │ " > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## main > > ── fsharp ────────────────────────────────────────────────────────────────────── > let main args = > SpiralTrace.TraceLevel.US0_1 |> set_trace_level > let argsMap = args |> Runtime.parseArgsMap<Arguments> > > let buildFileActions = > argsMap > |> Map.tryFind (nameof Arguments.Build_File) > |> Option.defaultValue [[]] > |> List.choose (function > | Arguments.Build_File (inputPath, outputPath) -> Some (inputPath, > outputPath) > | _ -> None > ) > > let fileTokenRangeActions = > argsMap > |> Map.tryFind (nameof Arguments.File_Token_Range) > |> Option.defaultValue [[]] > |> List.choose (function > | Arguments.File_Token_Range (inputPath, outputPath) -> Some > (inputPath, outputPath) > | _ -> None > ) > > let fileHoverAtActions = > argsMap > |> Map.tryFind (nameof Arguments.File_Hover_At) > |> Option.defaultValue [[]] > |> List.choose (function > | Arguments.File_Hover_At (inputPath, outputPath, line, character) > -> > Some (inputPath, outputPath, line, character) > | _ -> None > ) > > let executeCommandActions = > argsMap > |> Map.tryFind (nameof Arguments.Execute_Command) > |> Option.defaultValue [[]] > |> List.choose (function > | Arguments.Execute_Command command -> Some command > | _ -> None > ) > > let timeout = > match argsMap |> Map.tryFind (nameof Arguments.Timeout) with > | Some [[ Arguments.Timeout timeout ]] -> timeout > | _ -> 60002 * 60 * 24 > > let port = > match argsMap |> Map.tryFind (nameof Arguments.Port) with > | Some [[ Arguments.Port port ]] -> Some port > | _ -> None > > let isParallel = argsMap |> Map.containsKey (nameof Arguments.Parallel) > > let isExitOnError = argsMap |> Map.containsKey (nameof > Arguments.Exit_On_Error) > > async { > let port = > port > |> Option.defaultWith getCompilerPort > let struct (localToken, disposable) = > SpiralThreading.new_disposable_token None > // let! serverPort, _errors, compilerToken, disposable = awaitCompiler > port (Some localToken) > let serverPort = port > let struct (compilerToken, disposable) = > SpiralThreading.new_disposable_token None > use _ = disposable > > let buildFileAsync = > buildFileActions > |> List.map (fun (inputPath, outputPath) -> async { > let! _outputPath, outputCode, errors = > let backend = > if outputPath |> SpiralSm.ends_with ".gleam" > then Gleam > elif outputPath |> SpiralSm.ends_with ".fsx" > then Fsharp > elif outputPath |> SpiralSm.ends_with ".py" > then Python > elif outputPath |> SpiralSm.ends_with ".cpp" > then Cpp > else failwith $"Supervisor.main / invalid backend / > outputPath: {outputPath}" > let isReal = inputPath |> SpiralSm.ends_with ".spir" > inputPath |> buildFile backend timeout (Some serverPort) > None > > errors > |> List.map snd > |> List.iter (fun error -> > trace Critical (fun () -> $"main / error: {error |> > serializeObj}") _locals > ) > > match outputCode with > | Some outputCode -> > do! outputCode |> SpiralFileSystem.write_all_text_exists > outputPath > return 0 > | None -> > if isExitOnError > then SpiralRuntime.current_process_kill () > > return 1 > }) > > let fileTokenRangeAsync = > fileTokenRangeActions > |> List.map (fun (inputPath, outputPath) -> async { > let! tokenRange = inputPath |> getFileTokenRange (Some > serverPort) None > match tokenRange with > | Some tokenRange -> > do! tokenRange |> FSharp.Json.Json.serialize |> > SpiralFileSystem.write_all_text_exists outputPath > return 0 > | None -> > if isExitOnError > then SpiralRuntime.current_process_kill () > > return 1 > }) > > let fileHoverAtAsync = > fileHoverAtActions > |> List.map (fun (inputPath, outputPath, line, character) -> async { > let! hoverAt = > getFileHoverAt > (Some serverPort) > None > inputPath > {| line = line; character = character |} > match hoverAt with > | Some hoverAt -> > do! hoverAt |> FSharp.Json.Json.serialize |> > SpiralFileSystem.write_all_text_exists outputPath > return 0 > | None -> > if isExitOnError > then SpiralRuntime.current_process_kill () > > return 1 > }) > > let executeCommandAsync = > executeCommandActions > |> List.map (fun command -> async { > let! exitCode, result = > SpiralRuntime.execution_options (fun x -> > { x with > l0 = command > l1 = Some compilerToken > } > ) > |> SpiralRuntime.execute_with_options_async > > trace > Debug > (fun () -> > $"Supervisor.main / executeCommand / exitCode: > {exitCode} / command: {command}" > + " / result" > + if exitCode = 0 then ".Length" else "" > + ": " > + if exitCode = 0 then result |> String.length |> string > else result > ) > _locals > > if isExitOnError && exitCode <> 0 > then SpiralRuntime.current_process_kill () > > return exitCode > }) > > return! > [[| buildFileAsync; fileTokenRangeAsync; fileHoverAtAsync; > executeCommandAsync |]] > |> Seq.collect id > |> fun x -> > if isParallel > then Async.Parallel (x, float System.Environment.ProcessorCount > * 0.51 |> ceil |> int) > else Async.Sequential x > |> Async.map Array.sum > } > |> Async.runWithTimeout timeout > |> Option.defaultValue 1 > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let args = > System.Environment.GetEnvironmentVariable "ARGS" > |> SpiralRuntime.split_args > |> Result.toArray > |> Array.collect id > > match args with > | [[||]] -> 0 > | args -> if main args = 0 then 0 else failwith "main failed" > > ── [ 70.88ms - return value ] ────────────────────────────────────────────────── > │ <div class="dni-plaintext"><pre>0 > │ </pre></div><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> 00:01:28 v #3 runtime.execute_with_options / result / { file_name = dotnet; exit_code = 0; std_trace_length = 313567 } 00:01:28 d #4 runtime.execute_with_options / { file_name = jupyter; arguments = ["nbconvert", "/home/runner/work/polyglot/polyglot/apps/spiral/Supervisor.dib.ipynb", "--to", "html", "--HTMLExporter.theme=dark"]; options = { command = jupyter nbconvert "/home/runner/work/polyglot/polyglot/apps/spiral/Supervisor.dib.ipynb" --to html --HTMLExporter.theme=dark; cancellation_token = None; environment_variables = Array(MutCell([])); on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:01:29 v #5 ! [NbConvertApp] Converting notebook /home/runner/work/polyglot/polyglot/apps/spiral/Supervisor.dib.ipynb to html 00:01:29 v #6 ! /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/nbformat/__init__.py:96: MissingIDFieldWarning: Cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future. 00:01:29 v #7 ! validate(nb) 00:01:29 v #8 ! /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/nbconvert/filters/highlight.py:71: UserWarning: IPython3 lexer unavailable, falling back on Python 3 00:01:29 v #9 ! return _pygments_highlight( 00:01:31 v #10 ! [NbConvertApp] Writing 751861 bytes to /home/runner/work/polyglot/polyglot/apps/spiral/Supervisor.dib.html 00:01:31 v #11 runtime.execute_with_options / result / { file_name = jupyter; exit_code = 0; std_trace_length = 908 } 00:01:31 d #12 spiral.process_dib / dib / jupyter nbconvert / { exit_code = 0; jupyter_result_length = 908 } 00:01:31 d #13 runtime.execute_with_options / { file_name = pwsh; arguments = ["-c", "$counter = 1; $path = '/home/runner/work/polyglot/polyglot/apps/spiral/Supervisor.dib.html'; (Get-Content $path -Raw) -replace '(id=\\\"cell-id=)[a-fA-F0-9]{8}', { $_.Groups[1].Value + $counter++ } | Set-Content $path"]; options = { command = pwsh -c "$counter = 1; $path = '/home/runner/work/polyglot/polyglot/apps/spiral/Supervisor.dib.html'; (Get-Content $path -Raw) -replace '(id=\"cell-id=)[a-fA-F0-9]{8}', { $_.Groups[1].Value + $counter++ } | Set-Content $path"; cancellation_token = None; environment_variables = Array(MutCell([])); on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:01:31 v #14 runtime.execute_with_options / result / { file_name = pwsh; exit_code = 0; std_trace_length = 0 } 00:01:31 d #15 spiral.run / dib / html cell ids / { exit_code = 0; pwsh_replace_html_result_length = 0 } 00:01:31 d #16 spiral.process_dib / dib / { exit_code = 0; result_length = 314534 } 00:00:00 d #1 writeDibCode / output: Fs / path: Supervisor.dib 00:00:00 d #2 parseDibCode / output: Fs / file: Supervisor.dib 00:00:00 d #1 persistCodeProject / packages: [Argu; FSharp.Control.AsyncSeq; FSharp.Json; ... ] / modules: [deps/spiral/lib/spiral/common.fsx; deps/spiral/lib/spiral/sm.fsx; deps/spiral/lib/spiral/crypto.fsx; ... ] / name: Supervisor / hash: / code.Length: 41076 00:00:00 d #2 buildProject / fullPath: /home/runner/work/polyglot/polyglot/target/Builder/Supervisor/Supervisor.fsproj 00:00:00 d #1 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 "publish "/home/runner/work/polyglot/polyglot/target/Builder/Supervisor/Supervisor.fsproj" --configuration Release --output "/home/runner/work/polyglot/polyglot/apps/spiral/dist" --runtime linux-x64"; options = { command = dotnet publish "/home/runner/work/polyglot/polyglot/target/Builder/Supervisor/Supervisor.fsproj" --configuration Release --output "/home/runner/work/polyglot/polyglot/apps/spiral/dist" --runtime linux-x64; cancellation_token = None; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot/target/Builder/Supervisor"; stderr = true } } 00:00:00 v #2 > Determining projects to restore... 00:00:01 v #3 > Paket version 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 00:00:01 v #4 > The last full restore is still up to date. Nothing left to do. 00:00:01 v #5 > Total time taken: 0 milliseconds 00:00:01 v #6 > Paket version 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 00:00:01 v #7 > Restoring /home/runner/work/polyglot/polyglot/target/Builder/Supervisor/Supervisor.fsproj 00:00:01 v #8 > Starting restore process. 00:00:01 v #9 > Total time taken: 0 milliseconds 00:00:02 v #10 > Restored /home/runner/work/polyglot/polyglot/target/Builder/Supervisor/Supervisor.fsproj (in 291 ms). 00:00:29 v #11 > Supervisor -> /home/runner/work/polyglot/polyglot/target/Builder/Supervisor/bin/Release/net9.0/linux-x64/Supervisor.dll 00:00:30 v #12 > Supervisor -> /home/runner/work/polyglot/polyglot/apps/spiral/dist 00:00:30 d #13 runtime.execute_with_options_async / { exit_code = 0; output_length = 713; options = { command = dotnet publish "/home/runner/work/polyglot/polyglot/target/Builder/Supervisor/Supervisor.fsproj" --configuration Release --output "/home/runner/work/polyglot/polyglot/apps/spiral/dist" --runtime linux-x64; cancellation_token = None; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot/target/Builder/Supervisor"; stderr = true } } 00:00:00 d #1 spiral.main / { args = Array(MutCell(["dib", "--path", "Eval.dib", "--retries", "3"])) } 00:00:00 d #2 runtime.execute_with_options / { file_name = dotnet; arguments = ["repl", "--exit-after-run", "--run", "/home/runner/work/polyglot/polyglot/apps/spiral/Eval.dib", "--output-path", "/home/runner/work/polyglot/polyglot/apps/spiral/Eval.dib.ipynb"]; options = { command = dotnet repl --exit-after-run --run "/home/runner/work/polyglot/polyglot/apps/spiral/Eval.dib" --output-path "/home/runner/work/polyglot/polyglot/apps/spiral/Eval.dib.ipynb"; cancellation_token = None; environment_variables = Array(MutCell([("TRACE_LEVEL", "Verbose"), ("AUTOMATION", "True")])); on_line = None; stdin = None; trace = false; working_directory = None; stderr = true } } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ # Eval (Polyglot) > > ── fsharp ────────────────────────────────────────────────────────────────────── > #r > @"../../../../../../../.nuget/packages/fsharp.control.asyncseq/3.2.1/lib/netstan > dard2.1/FSharp.Control.AsyncSeq.dll" > #r > @"../../../../../../../.nuget/packages/system.reactive/6.0.1-preview.1/lib/net6. > 0/System.Reactive.dll" > #r > @"../../../../../../../.nuget/packages/system.reactive.linq/6.0.1-preview.1/lib/ > netstandard2.0/System.Reactive.Linq.dll" > #r > @"../../../../../../../.nuget/packages/argu/6.2.4/lib/netstandard2.0/Argu.dll" > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.http.connections.com > mon/7.0.0/lib/net7.0/Microsoft.AspNetCore.Http.Connections.Common.dll" > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.http.connections.cli > ent/7.0.0/lib/net7.0/Microsoft.AspNetCore.Http.Connections.Client.dll" > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.signalr.common/7.0.0 > /lib/net7.0/Microsoft.AspNetCore.SignalR.Common.dll" > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.signalr.client/7.0.0 > /lib/net7.0/Microsoft.AspNetCore.SignalR.Client.dll" > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.signalr.client.core/ > 7.0.0/lib/net7.0/Microsoft.AspNetCore.SignalR.Client.Core.dll" > #r > @"../../../../../../../.nuget/packages/fsharp.json/0.4.1/lib/netstandard2.0/FSha > rp.Json.dll" > #r > @"../../../../../../../.nuget/packages/system.management/7.0.0/lib/netstandard2. > 0/System.Management.dll" > > ── fsharp ────────────────────────────────────────────────────────────────────── > #r > @"../../../../../../../.nuget/packages/fsharpx.collections/3.1.0/lib/netstandard > 2.0/FSharpx.Collections.dll" > #r > @"../../../../../../../.nuget/packages/hopac/0.5.1/lib/netstandard2.0/Hopac.dll" > #r > @"../../../../../../../.nuget/packages/hopac/0.5.1/lib/netstandard2.0/Hopac.Core > .dll" > #r > @"../../../../../../../.nuget/packages/fparsec/2.0.0-beta2/lib/netstandard2.1/FP > arsec.dll" > #r > @"../../../../../../../.nuget/packages/fparsec/2.0.0-beta2/lib/netstandard2.1/FP > arsecCS.dll" > > ── fsharp ────────────────────────────────────────────────────────────────────── > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.dll" > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.dll" > #endif > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.SignalR.dll" > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.SignalR.dll" > #endif > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.SignalR.Core.dll" > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.SignalR.Core.dll" > #endif > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.Cors.dll" > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.Cors.dll" > #endif > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.Http.Abstractions.dll > " > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.Http.Abstractions.dll" > #endif > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.Connections.Abstracti > ons.dll" > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.Connections.Abstractions. > dll" > #endif > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.Hosting.Abstractions. > dll" > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.Hosting.Abstractions.dll" > #endif > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.Http.Connections.dll" > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.Http.Connections.dll" > #endif > > #if _LINUX > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x6 > 4/9.0.3/runtimes/linux-x64/lib/net9.0/Microsoft.AspNetCore.Routing.dll" > #else > #r > @"../../../../../../../.nuget/packages/microsoft.aspnetcore.app.runtime.win-x64/ > 9.0.3/runtimes/win-x64/lib/net9.0/Microsoft.AspNetCore.Routing.dll" > #endif > > ── pwsh ──────────────────────────────────────────────────────────────────────── > ls ~/.nuget/packages/microsoft.extensions.logging > echo "`n" > ls ~/.nuget/packages/microsoft.extensions.logging.abstractions > > ── [ 366.26ms - stdout ] ─────────────────────────────────────────────────────── > │ 2.1.1 > │ 6.0.0 > │ 8.0.1 > │ 9.0.0-preview.1.24080.9 > │ 9.0.10 > │ 9.0.5 > │ > │ > │ 6.0.0 > │ 8.0.1 > │ 8.0.2 > │ 9.0.0-preview.1.24080.9 > │ 9.0.10 > │ > > ── fsharp ────────────────────────────────────────────────────────────────────── > #r > @"../../../../../../../.nuget/packages/microsoft.extensions.logging/9.0.5/lib/ne > t9.0/Microsoft.Extensions.Logging.dll" > #r > @"../../../../../../../.nuget/packages/microsoft.extensions.logging.abstractions > /9.0.10/lib/net9.0/Microsoft.Extensions.Logging.Abstractions.dll" > #r > @"../../../../../../../.nuget/packages/microsoft.extensions.dependencyinjection. > abstractions/9.0.5/lib/net9.0/Microsoft.Extensions.DependencyInjection.Abstracti > ons.dll" > > ── fsharp ────────────────────────────────────────────────────────────────────── > open spiral_compiler > > ── fsharp ────────────────────────────────────────────────────────────────────── > #if !INTERACTIVE > open Lib > #endif > > ── fsharp ────────────────────────────────────────────────────────────────────── > open Common > open SpiralFileSystem.Operators > open Microsoft.AspNetCore.SignalR.Client > > ── fsharp ────────────────────────────────────────────────────────────────────── > open System > open System.Collections.Generic > open System.IO > open System.Text > open System.Threading > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## mapErrors > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline mapErrors (severity, errors, lastTopLevelIndex) allCode = > let allCodeLineLength = > allCode |> SpiralSm.split "\n" |> Array.length > > errors > |> List.map (fun (_, error) -> > match error with > | FatalError message -> > ( > severity, message, 0, ("", (0, 0), (0, 0)) > ) > |> List.singleton > | TracedError data -> > data.trace > |> List.truncate 5 > |> List.append [[ data.message ]] > |> List.map (fun message -> > ( > severity, message, 0, ("", (0, 0), (0, 0)) > ) > ) > | PackageErrors data > | TokenizerErrors data > | ParserErrors data > | TypeErrors data -> > data.errors > |> List.filter (fun ((rangeStart, _), _) -> > trace Debug (fun () -> $"Eval.mapErrors / rangeStart.line: > {rangeStart.line} / lastTopLevelIndex: {lastTopLevelIndex} / allCodeLineLength: > {allCodeLineLength} / filtered: {rangeStart.line > allCodeLineLength}") _locals > rangeStart.line > allCodeLineLength > ) > |> List.map (fun ((rangeStart, rangeEnd), message) -> > ( > severity, > message, > 0, > ( > (data.uri |> System.IO.Path.GetFileName), > ( > (match lastTopLevelIndex with > | Some i when rangeStart.line >= i + > allCodeLineLength + 3 -> > rangeStart.line - allCodeLineLength - 2 > | _ -> rangeStart.line - allCodeLineLength), > (match lastTopLevelIndex with > | Some i when rangeStart.line >= i + > allCodeLineLength + 3 -> > rangeStart.character - 4 > | _ -> rangeStart.character) > ), > ( > (match lastTopLevelIndex with > | Some i when rangeStart.line >= i + > allCodeLineLength + 3 -> > rangeEnd.line - allCodeLineLength - 2 > | _ -> rangeEnd.line - allCodeLineLength), > (match lastTopLevelIndex with > | Some i when rangeStart.line >= i + > allCodeLineLength + 3 -> > rangeEnd.character - 4 > | _ -> rangeEnd.character) > ) > ) > ) > ) > ) > |> List.collect id > |> List.toArray > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### workspaceRoot > > ── fsharp ────────────────────────────────────────────────────────────────────── > let workspaceRoot = SpiralFileSystem.get_workspace_root () > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### targetDir > > ── fsharp ────────────────────────────────────────────────────────────────────── > let targetDir = workspaceRoot </> "target/spiral_Eval" > [[ targetDir ]] > |> List.iter (fun dir -> if Directory.Exists dir |> not then > Directory.CreateDirectory dir |> ignore) > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## allCode > > ── fsharp ────────────────────────────────────────────────────────────────────── > let mutable allCode = "" > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ### allPackages > > ── fsharp ────────────────────────────────────────────────────────────────────── > let mutable allPackages : string [[]] = [[||]] > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## allCodeReal > > ── fsharp ────────────────────────────────────────────────────────────────────── > let mutable allCodeReal = "" > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## traceToggle > > ── fsharp ────────────────────────────────────────────────────────────────────── > let mutable traceToggle = false > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## startTokenRangeWatcher > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline startTokenRangeWatcher () = > if [[ "dotnet-repl" ]] |> List.contains spiral_compiler.assemblyName > then new_disposable (fun () -> ()) > else > let tokensDir = targetDir </> "tokens" > > [[ tokensDir ]] > |> List.iter (fun dir -> if Directory.Exists dir |> not then > Directory.CreateDirectory dir |> ignore) > > let stream, disposable = FileSystem.watchDirectory (fun _ -> false) > tokensDir > > try > let existingFilesChild = > tokensDir > |> System.IO.Directory.GetDirectories > |> Array.map (fun codeDir -> async { > try > let tokensPath = codeDir </> "tokens.json" > if tokensPath |> File.Exists |> not then > let spiralCodePath = codeDir </> "main.spi" > let spiralRealCodePath = codeDir </> > "main_real.spir" > let spiralExists = spiralCodePath |> > System.IO.File.Exists > let spiralRealExists = spiralRealCodePath |> > System.IO.File.Exists > if spiralExists |> not && spiralRealExists |> not > then do! codeDir |> > SpiralFileSystem.delete_directory_async |> Async.Ignore > else > let! tokens = > if spiralExists then spiralCodePath else > spiralRealCodePath > |> Supervisor.getFileTokenRange None None > match tokens with > | Some tokens -> > do! > tokens > |> FSharp.Json.Json.serialize > |> SpiralFileSystem.write_all_text_async > tokensPath > | None -> > trace Verbose (fun () -> > $"Eval.startTokenRangeWatcher / GetDirectories / tokens: None") _locals > with ex -> > trace Critical (fun () -> $"Eval.startTokenRangeWatcher > / GetDirectories / ex: {ex |> SpiralSm.format_exception}") _locals > }) > |> Async.Parallel > |> Async.Ignore > > let streamAsyncChild = > stream > |> FSharp.Control.AsyncSeq.iterAsyncParallel (fun (ticks, event) > -> > match event with > | FileSystem.FileSystemChange.Changed (codePath, _) > when [[ "main.spi"; "main_real.spir" ]] > |> List.contains (System.IO.Path.GetFileName > codePath) > -> > async { > let hashDir = codePath |> > System.IO.Directory.GetParent > let hashHex = hashDir.Name > let codePath = tokensDir </> codePath > let tokensPath = tokensDir </> hashHex </> > "tokens.json" > // do! Async.Sleep 30 > let rec 루프 retry = async { > let! tokens = codePath |> > Supervisor.getFileTokenRange None None > if retry = 3 || tokens <> Some [[||]] > then return tokens, retry > else > trace Debug > (fun () -> $"Eval.startTokenRangeWatcher > / iterAsyncParallel") > (fun () -> $"retry: {retry} / tokens: > %A{tokens}") > do! Async.Sleep 30 > return! 루프 (retry + 1) > } > let! tokens, retries = 루프 1 > match tokens with > | Some tokens -> > do! > tokens > |> FSharp.Json.Json.serialize > |> SpiralFileSystem.write_all_text_exists > tokensPath > | None -> > trace Debug > (fun () -> $"Eval.startTokenRangeWatcher / > iterAsyncParallel") > (fun () -> $"retries: {retries} / tokens: > {tokens}") > } > |> Async.retryAsync 3 > |> Async.map (Result.toOption >> Option.defaultValue ()) > | _ -> () |> Async.init > ) > > async { > do! Async.Sleep 3000 > existingFilesChild |> Async.StartImmediate > streamAsyncChild |> Async.Start > } > |> Async.Start > with ex -> > trace Critical (fun () -> $"Eval.startTokenRangeWatcher / ex: {ex |> > SpiralSm.format_exception}") _locals > > disposable > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## startCommandsWatcher > > ── fsharp ────────────────────────────────────────────────────────────────────── > let startCommandsWatcher (uriServer : string) = > let commandsDir = targetDir </> "eval_commands" > let commandHistoryDir = targetDir </> "eval_command_history" > [[ commandsDir; commandHistoryDir ]] > |> List.iter (fun dir -> if Directory.Exists dir |> not then > Directory.CreateDirectory dir |> ignore) > > Directory.EnumerateFiles commandsDir |> Seq.iter File.Delete > > let stream, disposable = > commandsDir > |> FileSystem.watchDirectory (function > | FileSystem.FileSystemChange.Created _ -> true > | _ -> false > ) > > let connection = HubConnectionBuilder().WithUrl(uriServer).Build() > connection.StartAsync() |> Async.AwaitTask |> Async.Start > // let _ = connection.On<string>("ServerToClientMsg", fun x -> > // printfn $"ServerToClientMsg: '{x}'" > // ) > > stream > |> FSharp.Control.AsyncSeq.iterAsyncParallel (fun (ticks, event) -> async { > let _locals () = $"ticks: {ticks} / event: {event} / {_locals ()}" > trace Verbose (fun () -> "Eval.startCommandsWatcher / > iterAsyncParallel") _locals > > match event with > | FileSystem.FileSystemChange.Created (path, Some json) -> > try > let fullPath = commandsDir </> path > let! result = > connection.InvokeAsync<string>("ClientToServerMsg", json) |> Async.AwaitTask > let commandHistoryPath = commandHistoryDir </> path > do! fullPath |> SpiralFileSystem.move_file_async > commandHistoryPath |> Async.Ignore > if result |> SpiralSm.trim |> String.length > 0 then > let resultPath = commandHistoryDir </> > $"{Path.GetFileNameWithoutExtension path}_result.json" > do! result |> SpiralFileSystem.write_all_text_async > resultPath > with ex -> > let _locals () = $"ex: {ex |> SpiralSm.format_exception} / > {_locals ()}" > trace Critical (fun () -> "Eval.startCommandsWatcher / > iterAsyncParallel") _locals > | _ -> () > }) > |> Async.StartChild > |> Async.Ignore > |> Async.Start > > new_disposable (fun () -> > disposable.Dispose () > ) > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## prepareSpiral > > ── fsharp ────────────────────────────────────────────────────────────────────── > let prepareSpiral rawCellCode lines = > let lastBlock = > lines > |> Array.tryFindBack (fun line -> > line |> String.length > 0 > && line.[[0]] <> ' ' > ) > > let hasMain = > lastBlock > |> Option.exists (fun line -> > line |> SpiralSm.starts_with "inl main " > || line |> SpiralSm.starts_with "let main " > ) > > if hasMain > then rawCellCode, None > else > let lastTopLevelIndex, _ = > (lines |> Array.indexed, (None, false)) > ||> Array.foldBack (fun (i, line) (lastTopLevelIndex, finished) -> > // trace Verbose (fun () -> $"Eval.prepareSpiral / i: {i} / > line: '{line}' / lastTopLevelIndex: {lastTopLevelIndex} / finished: {finished}") > _locals > match line with > | _ when finished -> lastTopLevelIndex, true > | "" -> lastTopLevelIndex, false > | line when > line |> SpiralSm.starts_with " " > || line |> SpiralSm.starts_with "// " -> lastTopLevelIndex, > false > | line when > line |> SpiralSm.starts_with "open " > || line |> SpiralSm.starts_with "prototype " > || line |> SpiralSm.starts_with "instance " > || line |> SpiralSm.starts_with "type " > || line |> SpiralSm.starts_with "union " > || line |> SpiralSm.starts_with "nominal " -> > lastTopLevelIndex, true > | line when > line |> SpiralSm.starts_with "inl " > || line |> SpiralSm.starts_with "and " > || line |> SpiralSm.starts_with "let " -> > let m = > System.Text.RegularExpressions.Regex.Match ( > line, > @"^(?:and +)?(inl|let) +((?:[[{( > ]]*)?[[~\(\w]]+[[\w\d']]*(?:|[[\w\d']]+[[ }]]*(?:&? *[[\w\d']]*\))?| > *[[~\w]][[\w\d']]*\)|, *[[~\w]][[\w\d']]*)) +[[:=]](?! +function)" > ) > trace Verbose (fun () -> $"Eval.prepareSpi / m: '{m}' / > m.Groups.Count: {m.Groups.Count}") _locals > if m.Groups.Count = 3 > then Some i, false > else lastTopLevelIndex, true > | _ -> Some i, false > ) > let code = > match lastTopLevelIndex with > | Some lastTopLevelIndex -> > lines > |> Array.mapi (fun i line -> > match i with > | i when i < lastTopLevelIndex -> line > | i when i = lastTopLevelIndex -> $"\nlet main () =\n > {line}" > | _ when line |> SpiralSm.trim = "" -> "" > | _ -> $" {line}" > ) > |> SpiralSm.concat "\n" > | None -> $"{rawCellCode}\n\ninl main () = ()\n" > code, lastTopLevelIndex > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## processSpiralOutput > > ── fsharp ────────────────────────────────────────────────────────────────────── > let processSpiralOutput > (props : {| > printCode: bool > traceLevel: TraceLevel > builderCommands: string array > lastTopLevelIndex: int option > backend: Supervisor.Backend > cancellationToken: _ > spiralErrors: _ > code: string > outputPath: string > isReal: bool > |}) > = async { > let inline _trace (fn : unit -> string) = > if props.traceLevel = Verbose > then trace Info (fun () -> $"Eval.processSpiralOutput / props: {props |> > FSharp.Json.Json.serialize |> SpiralSm.ellipsis_end 400} / {fn ()}") _locals > else fn () |> System.Console.WriteLine > > if props.printCode > && props.backend <> Supervisor.Gleam > && props.backend <> Supervisor.Python > && props.backend <> Supervisor.Cpp then > let ext = props.outputPath |> System.IO.Path.GetExtension > _trace (fun () -> if props.builderCommands.Length > 0 then > $"{ext}:\n{props.code}\n" else props.code) > > let workspaceRootExternal = > let currentDir = System.IO.Directory.GetCurrentDirectory () |> > SpiralSm.to_lower > let workspaceRoot = workspaceRoot |> SpiralSm.to_lower > if currentDir |> SpiralSm.starts_with workspaceRoot > then None > else Some workspaceRoot > > let! spiralBuilderResults = > match props.builderCommands, props.lastTopLevelIndex with > | [[||]], _ | _, None -> [[||]] |> Async.init > | builderCommands, _ -> > builderCommands > |> Array.map (fun builderCommand -> > let path = > workspaceRoot </> > $@"deps/spiral/workspace/target/release/spiral{SpiralPlatform.get_executable_suf > fix ()}" > |> System.IO.Path.GetFullPath > let commands = > if props.backend = Supervisor.Fsharp > && ( > builderCommand |> SpiralSm.starts_with "rust" > || builderCommand |> SpiralSm.starts_with > "typescript" > || builderCommand |> SpiralSm.starts_with "python" > ) > then [[| $"{path} fable --fs-path \"{props.outputPath}\" > --command \"{builderCommand}\"" |]] > elif props.backend = Supervisor.Python > && builderCommand |> SpiralSm.starts_with "cuda" > then [[| $"{path} {builderCommand} --py-path > \"{props.outputPath}\"" |]] > elif props.backend = Supervisor.Cpp > && builderCommand |> SpiralSm.starts_with "cpp" > then [[| $"{path} {builderCommand} --cpp-path > \"{props.outputPath}\"" |]] > elif props.backend = Supervisor.Gleam > && builderCommand |> SpiralSm.starts_with "gleam" > then [[| $"{path} {builderCommand} --gleam-path > \"{props.outputPath}\"" |]] > else [[||]] > builderCommand, commands > ) > |> Array.filter (fun (_, commands) -> commands.Length > 0) > |> Array.collect (fun (builderCommand, commands) -> > commands > |> Array.map (fun command -> async { > let! exitCode, result = > SpiralRuntime.execution_options (fun x -> > { x with > l0 = command > l1 = props.cancellationToken > l2 = [[| > "AUTOMATION", spiral_compiler.assemblyName = > "dotnet-repl" |> string > "TRACE_LEVEL", $"%A{if props.printCode then > props.traceLevel else Info}" > |]] > l6 = workspaceRootExternal > } > ) > |> SpiralRuntime.execute_with_options_async > trace Debug > (fun () -> $"Eval.processSpiralOutput / spiral cli") > (fun () -> $"exitCode: {exitCode} / builderCommand: > {builderCommand} / command: {command} / result: {result |> SpiralSm.ellipsis_end > 400} / {_locals ()}") > return > if exitCode = 0 > then {| code = result; eval = false; builderCommand = > builderCommand |} |> Ok > else result |> Error > }) > ) > |> Async.Parallel > > let hasEval = > props.backend = Supervisor.Fsharp > && props.builderCommands |> Array.exists (fun x -> x |> > SpiralSm.starts_with "fsharp") > > let outputResult = > if props.builderCommands.Length > 0 && not hasEval > then None > else > let code = > if props.builderCommands.Length > 1 > then > let header = "System.Console.WriteLine \".fsx output:\"\n" > $"{header}{props.code}" > else props.code > Some (Ok [[ {| code = code; eval = true; builderCommand = "" |} ]]) > > match outputResult, spiralBuilderResults with > | Some outputResult, [[||]] -> > return outputResult, [[||]] > | None, [[||]] -> > return Ok [[ {| code = "()"; eval = true; builderCommand = "" |} ]], > [[||]] > | _, spiralBuilderResults -> > try > let spiralResults = > match outputResult with > | Some (Ok code) -> > spiralBuilderResults > |> Array.append (code |> List.map Ok |> List.toArray) > | _ -> spiralBuilderResults > let codes = > spiralResults > |> Array.map (fun spiralBuilderResult' -> > let commandResult, errors = > match spiralBuilderResult' with > | Ok result when result.eval = false -> > let result' = > result.code > |> > FSharp.Json.Json.deserialize<Map<string,string>> > let result = > match result' |> Map.tryFind "command_result" > with > | Some result'' -> > result'' > |> > FSharp.Json.Json.deserialize<Map<string,string>> > |> Map.add "builderCommand" > result.builderCommand > | None -> Map.empty > result, [[||]] > | Ok result when result.eval = true -> > let result = > [[ > "extension", "fsx" > "code", result.code > "output", "" > ]] > |> Map.ofList > result, [[||]] > | Error error -> > Map.empty, > [[| > ( > TraceLevel.Critical, > $"Eval.processSpiralOutput / evalResult error / errors[[0]] / outputPath: > {props.outputPath} / builderCommands: %A{props.builderCommands} / > spiralBuilderResult': %A{spiralBuilderResult'} / error: %A{error}", 0, ("", (0, > 0), (0, 0)) > ) > |]] > | _ -> > Map.empty, [[||]] > > if errors |> Array.isEmpty |> not > then Error (Exception $"Eval.processSpiralOutput / > evalResult errors / Exception / commandResult: %A{commandResult}"), errors > else > let extension = commandResult.[["extension"]] > let code = commandResult.[["code"]] > let output = commandResult.[["output"]] > let builderCommand = > commandResult > |> Map.tryFind "builderCommand" > |> Option.defaultValue "" > > let backendInfo = > match props.backend, builderCommand with > | Supervisor.Fsharp, builderCommand > when builderCommand |> SpiralSm.contains " " -> > $" ({builderCommand})" > | Supervisor.Fsharp, _ -> "" > | _ -> $" ({props.backend})" > > let eval = output = "" && extension = "fsx" > > if props.printCode && not eval > then _trace (fun () -> > $""".{extension}{backendInfo}:{'\n'}{code}""") > > trace Debug > (fun () -> $"Eval.processSpiralOutput / result") > (fun () -> $"builderCommand: {builderCommand} / > extension: {extension} / commandResult: {commandResult |> > FSharp.Json.Json.serialize |> SpiralSm.ellipsis_end 400}/ {_locals ()}") > > let code = > if props.printCode > || spiralResults.Length > 1 > || props.builderCommands.Length > 1 > then > if eval > then code > else > let header = $".{extension} > output{backendInfo}:\n" > $"""{if output |> SpiralSm.contains "\n" > then "\n" else ""}{header}{output}""" > elif eval > then code > else output > Ok {| code = code; eval = eval; builderCommand = > builderCommand |}, [[||]] > ) > trace Debug > (fun () -> $"Eval.processSpiralOutput / codes") > (fun () -> > let props = {| props with cancellationToken = None |} > $"codes: {codes |> FSharp.Json.Json.serialize |> > SpiralSm.ellipsis_end 400} / spiralResults: {spiralResults |> > FSharp.Json.Json.serialize |> SpiralSm.ellipsis_end 400} / spiralBuilderResults: > {spiralBuilderResults |> FSharp.Json.Json.serialize |> SpiralSm.ellipsis_end > 400} / props: {props |> FSharp.Json.Json.serialize |> SpiralSm.ellipsis_end 400} > / {_locals ()}") > return > (((Ok [[]]), [[||]]), codes) > ||> Array.fold (fun (acc_code, acc_errors) (code, errors) -> > match code, acc_code with > | Ok code, Ok acc_code -> > let errors = > acc_errors > |> Array.append errors > |> Array.append props.spiralErrors > let errors = > if errors |> Array.isEmpty > then errors > else > let code = $"%A{code}" > errors > |> Array.append [[| > TraceLevel.Critical, > $"Eval.processSpiralOutput / errors / errors[[-1]] / outputPath: > {props.outputPath} / builderCommands: %A{props.builderCommands} / code: {code |> > SpiralSm.ellipsis_end 400}", 0, ("", (0, 0), (0, 0)) > |]] > Ok (code :: acc_code), errors > | Error ex, _ > | _, Error ex -> > Error (Exception $"Eval.processSpiralOutput / -1 / > Exception / spiralBuilderResults: %A{spiralBuilderResults} / ex: {ex |> > SpiralSm.format_exception}"), > acc_errors |> Array.append errors > ) > with ex -> > trace Critical (fun () -> $"Eval.processSpiralOutput / try 2 ex / > spiralBuilderResults: %A{spiralBuilderResults} / ex: {ex |> > SpiralSm.format_exception}") _locals > return > Error (Exception $"Eval.processSpiralOutput / try 2 ex / > Exception / spiralBuilderResults: %A{spiralBuilderResults} / ex: {ex |> > SpiralSm.format_exception}"), > [[| > ( > TraceLevel.Critical, $"Eval.processSpiralOutput / try 2 > ex / errors[[0]] / spiralBuilderResults: %A{spiralBuilderResults} / ex: {ex |> > SpiralSm.format_exception}", 0, ("", (0, 0), (0, 0)) > ) > |]] > } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## tryGetPropertyValue > > ── fsharp ────────────────────────────────────────────────────────────────────── > let tryGetPropertyValue (propertyName: string) (obj: obj) = > let objType = obj.GetType () > let propertyInfo = propertyName |> objType.GetProperty > if propertyInfo <> null > then propertyInfo.GetValue (obj, null) |> Some > else None > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## evalAsync > > ── fsharp ────────────────────────────────────────────────────────────────────── > let rec evalAsync > retry > (props : {| > rawCellCode: _ > lines: _ > isReal: _ > builderCommands: _ array > isCache: _ > timeout: _ > cancellationToken: _ > printCode: _ > traceLevel: _ > fsi_eval: _ > |}) > = async { > try > let cellCode, lastTopLevelIndex = prepareSpiral props.rawCellCode > props.lines > let newAllCode = > if props.isReal > then $"{allCodeReal}\n\n{cellCode}" > else $"{allCode}\n\n{cellCode}" > > let buildBackends = > if props.builderCommands.Length = 0 > then [[| Supervisor.Fsharp |]] > else > props.builderCommands > |> Array.map (fun x -> > if x |> SpiralSm.starts_with "gleam" > then Supervisor.Gleam > elif x |> SpiralSm.starts_with "cuda" > then Supervisor.Python > elif x |> SpiralSm.starts_with "cpp" > then Supervisor.Cpp > else Supervisor.Fsharp > ) > |> Array.distinct > > trace Verbose > (fun () -> $"Eval.eval") > (fun () -> $"lastTopLevelIndex: {lastTopLevelIndex} / > builderCommands: %A{props.builderCommands} / buildBackends: %A{buildBackends} / > isReal: {props.isReal} / {_locals ()}") > > let! buildCodeResults = > buildBackends > |> Array.map (fun backend -> async { > let! result = > if props.isReal > then Supervisor.Spir newAllCode > else > Supervisor.Spi > (newAllCode, if allCodeReal = "" then None else Some > allCodeReal) > |> Supervisor.buildCode backend allPackages props.isCache > props.timeout props.cancellationToken > return backend, result > }) > |> Async.Parallel > |> Async.catch > |> Async.runWithTimeoutAsync props.timeout > > match buildCodeResults with > | Some (Ok buildCodeResults) -> > let! result, errors = > ((Ok [[]], [[||]]), buildCodeResults) > ||> Async.fold (fun acc buildCodeResult -> async { > match buildCodeResult with > | backend, (_, (outputPath, Some code), spiralErrors) -> > let spiralErrors = > allCode |> mapErrors (Warning, spiralErrors, > lastTopLevelIndex) > let! result = > processSpiralOutput > {| > printCode = props.printCode > traceLevel = props.traceLevel > builderCommands = props.builderCommands > lastTopLevelIndex = lastTopLevelIndex > backend = backend > cancellationToken = props.cancellationToken > spiralErrors = spiralErrors > code = code > outputPath = outputPath > isReal = props.isReal > |} > match result, acc with > | (Ok code, errors), (Ok acc_code, acc_errors) -> > return Ok (acc_code @ code), acc_errors |> > Array.append errors > | (Error ex, errors), _ | _, (Error ex, errors) -> > return > Error (Exception $"Eval.evalAsync / > processSpiralOutput / Exception / buildCodeResult: %A{buildCodeResult |> > FSharp.Json.Json.serialize |> SpiralSm.ellipsis_end 400} / ex: {ex |> > SpiralSm.format_exception}"), > errors |> Array.append errors > | _, (_, _, errors) when errors |> List.isEmpty |> not -> > return errors.[[0]] |> fst |> Exception |> Error, > allCode |> mapErrors (TraceLevel.Critical, errors, > lastTopLevelIndex) > | _ -> return acc > }) > let cancellationToken = defaultArg props.cancellationToken > System.Threading.CancellationToken.None > match result, errors with > | Ok code, [[||]] -> > let code, eval = > code > |> List.map (fun code -> > if code.eval > then None, Some code.code > else Some code.code, None > ) > |> List.unzip > let code = code |> List.choose id > let eval = eval |> List.choose id > > trace Debug > (fun () -> $"Eval.eval") > (fun () -> $"eval: {eval |> FSharp.Json.Json.serialize |> > SpiralSm.ellipsis_end 400} / code: {code |> FSharp.Json.Json.serialize |> > SpiralSm.ellipsis_end 400} / {_locals ()}") > > let ch, errors = > match eval, code with > | [[]], [[]] -> > Choice2Of2 (Exception $"Eval.evalAsync / eval=[[]] / > code=[[]] / buildCodeResults: %A{buildCodeResults} / code: %A{code}"), errors > | [[ eval ]], [[]] -> > let eval = > if eval |> SpiralSm.contains "<script" > then $"{eval}, \"text/html1\"" > else eval > let ch, errors2 = props.fsi_eval eval cancellationToken > let errors = > errors2 > // |> Array.map (fun (e1, e2, e3, _) -> > // (e1, e2, e3, ("", (0, 0), (0, 0))) > // ) > |> Array.append errors > ch, errors > | [[]], _ -> > let code = code |> List.rev |> String.concat "\n\n" > let code = > if props.printCode > then $"\"\"\"{code}\n\n\"\"\"" > else $"\"\"\"{code}\n\"\"\"" > let code = > if code |> SpiralSm.contains "<script" > then $"{code}, \"text/html2\"" > else code > let ch, errors2 = props.fsi_eval code cancellationToken > let errors = > errors2 > // |> Array.map (fun (e1, e2, e3, _) -> > // (e1, e2, e3, ("", (0, 0), (0, 0))) > // ) > |> Array.append errors > ch, errors > | _ -> > let code, errors = > ((Ok (code |> List.rev), [[||]]), eval) > ||> List.fold (fun (acc, acc_errors) eval -> > match acc with > | Error ch -> Error ch, acc_errors > | Ok acc -> > let eval = > if eval |> SpiralSm.contains "<script" > then $"{eval}, \"text/html3\"" > else eval > let ch, errors = props.fsi_eval eval > cancellationToken > let errors = > errors > // |> Array.map (fun (e1, e2, e3, _) -> > // (e1, e2, e3, ("", (0, 0), (0, > 0))) > // ) > |> Array.append acc_errors > match ch with > | Choice1Of2 v -> > let v = > v > |> tryGetPropertyValue > "ReflectionValue" > |> Option.map (fun x -> $"%A{x}") > |> Option.defaultValue "" > Ok (v :: acc), errors > | Choice2Of2 ex -> > trace Critical (fun () -> > $"Eval.evalAsync / fsi_eval fold Choice error / buildCodeResults: > %A{buildCodeResults} / ex: {ex |> SpiralSm.format_exception}") _locals > Error ch, errors > ) > match code with > | Error ch -> ch, errors > | Ok code -> > let code = > code > |> List.filter ((<>) "") > |> String.concat "\n\n" > > let code = > if props.builderCommands.Length > 0 && > eval.Length = 0 > then code > elif code |> SpiralSm.contains "\n\n\n" > then $"{code}\n\n" > else $"{code}\n" > > let code = > if props.printCode > then $"\"\"\"{code}\n\n\n\"\"\"" > else $"\"\"\"{code}\n\"\"\"" > let code = > if code |> SpiralSm.contains "<script" > then $"{code}, \"text/html4\"" > else code > let ch, errors2 = props.fsi_eval code > cancellationToken > let errors = > errors2 > // |> Array.map (fun (e1, e2, e3, _) -> > // (e1, e2, e3, ("", (0, 0), (0, 0))) > // ) > |> Array.append errors > ch, errors > match ch with > | Choice1Of2 v -> > if props.isReal > then allCodeReal <- newAllCode > else allCode <- newAllCode > return Ok(v), errors > | Choice2Of2 ex -> > return > Error (Exception $"Eval.evalAsync / -2 / Exception / ex: > {ex |> SpiralSm.format_exception} / buildCodeResults: {buildCodeResults |> > FSharp.Json.Json.serialize |> SpiralSm.ellipsis_end 400}"), > errors > | Ok code, errors -> > return > Error (Exception "Eval.evalAsync / errors / > buildCodeResults: %A{buildCodeResults} / code: %A{code}"), > errors > | Error ex, errors -> > let ex = ex |> SpiralSm.format_exception > if retry <= 3 && > (ex |> SpiralSm.contains "Expected one of: inl, let, union, > nominal, prototype, type, instance, and, open") > || (ex |> SpiralSm.contains "Unexpected end of block past > this token.") > || (ex |> SpiralSm.contains "Unbound variable:") > then return! evalAsync (retry + 1) props > else > return > Error (Exception $"Eval.evalAsync / -1 / Exception / ex: > {ex} / buildCodeResults: {buildCodeResults |> FSharp.Json.Json.serialize |> > SpiralSm.ellipsis_end 1500}"), > errors > | Some (Error ex) -> > trace Critical (fun () -> $"Eval.evalAsync / buildCodeResults Error > / buildCodeResults: %A{buildCodeResults} / ex: {ex |> > SpiralSm.format_exception}") _locals > return > Error (Exception $"Eval.evalAsync / buildCodeResults Error / > Exception / buildCodeResults: %A{buildCodeResults} / ex: {ex |> > SpiralSm.format_exception}"), > [[| > ( > TraceLevel.Critical, $"Eval.evalAsync / buildCodeResults > Error / errors[[0]] / ex: {ex |> SpiralSm.format_exception} / buildCodeResults: > %A{buildCodeResults}", 0, ("", (0, 0), (0, 0)) > ) > |]] > | _ -> > return > Error (Exception $"Eval.evalAsync / buildCodeResults / Exception > / buildCodeResults: %A{buildCodeResults}"), > [[| > ( > TraceLevel.Critical, $"Eval.evalAsync / buildCodeResults > / errors[[0]] / buildCodeResults: %A{buildCodeResults}", 0, ("", (0, 0), (0, 0)) > ) > |]] > with ex -> > trace Critical (fun () -> $"Eval.evalAsync / try 1 ex / ex: {ex |> > SpiralSm.format_exception} / lines: %A{props.lines}") _locals > return > Error (Exception $"Eval.evalAsync / try 1 ex / Exception / ex: {ex > |> SpiralSm.format_exception} / lines: %A{props.lines}"), > [[| > ( > TraceLevel.Critical, $"Eval.evalAsync / try 1 ex / > errors[[0]] / ex: {ex |> SpiralSm.format_exception} / lines: %A{props.lines}", > 0, ("", (0, 0), (0, 0)) > ) > |]] > } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## eval > > ── fsharp ────────────────────────────────────────────────────────────────────── > let inline eval > (fsi_eval: > string > -> System.Threading.CancellationToken > -> Choice<'a, Exception> * (TraceLevel * string * int * (string * (int * > int) * (int * int))) array) > (cancellationToken: Option<System.Threading.CancellationToken>) > (code: string) > = > trace Verbose > (fun () -> $"Eval.eval") > (fun () -> $"code: {code |> SpiralSm.ellipsis_end 400} / {_locals ()}") > > let rawCellCode = > code |> SpiralSm.replace "\r\n" "\n" > > let lines = rawCellCode |> SpiralSm.split "\n" > > if lines |> Array.exists (fun line -> line |> SpiralSm.starts_with "#r " && > line |> SpiralSm.ends_with "\"") then > let cancellationToken = defaultArg cancellationToken > System.Threading.CancellationToken.None > let code = > if code |> SpiralSm.contains "<script" > then $"{code}, \"text/html5\"" > else code > let ch, errors = fsi_eval code cancellationToken > trace Verbose (fun () -> $"Eval.eval / fsi_eval 1 / ch: %A{ch} / errors: > %A{errors}") _locals > match ch with > | Choice1Of2 v -> Ok(v), errors > | Choice2Of2 ex -> Error(ex), errors > else > let builderCommands = > lines > |> Array.choose (fun line -> > if line |> SpiralSm.starts_with "///! " > then line |> SpiralSm.split "///! " |> Array.tryItem 1 > else None > ) > > let packages = > lines > |> Array.choose (fun line -> > if line |> SpiralSm.starts_with "//// package=" > then line |> SpiralSm.split "=" |> Array.skip 1 |> > SpiralSm.concat "" |> Some > else None > ) > > allPackages <- packages |> Array.append allPackages |> Array.distinct > > let timeout = > lines > |> Array.tryPick (fun line -> > if line |> SpiralSm.starts_with "//// timeout=" > then line |> SpiralSm.split "=" |> Array.tryItem 1 |> Option.map > int > else None > ) > |> Option.defaultValue (60003 * 60 * 24) > > let boolArg def command = > lines > |> Array.tryPick (fun line -> > let text = $"//// {command}" > match line.[[0..text.Length-1]], line.[[text.Length..]] with > | head, "" when head = text -> > Some true > | head, _ when head = text -> > line |> SpiralSm.split "=" |> Array.tryItem 1 |> Option.map > ((<>) "false") > | _ -> None > ) > |> Option.defaultValue def > > let printCode = "print_code" |> boolArg false > let isTraceToggle = "trace_toggle" |> boolArg false > let isTrace = "trace" |> boolArg false > let isCache = "cache" |> boolArg false > let isReal = "real" |> boolArg false > let timeout_continue = "timeout_continue" |> boolArg false > > if isTraceToggle > then traceToggle <- not traceToggle > > let oldLevel = get_trace_level () > let traceLevel = > if isTrace || traceToggle > then Verbose > else Info > traceLevel > |> to_trace_level > |> set_trace_level > use _ = (new_disposable (fun () -> > oldLevel |> set_trace_level > )) > > evalAsync 1 > {| > rawCellCode = rawCellCode > lines = lines > isReal = isReal > builderCommands = builderCommands > isCache = isCache > timeout = timeout > cancellationToken = cancellationToken > printCode = printCode > traceLevel = traceLevel > fsi_eval = fsi_eval > |} > |> Async.runWithTimeout timeout > |> (fun x -> > match x with > | Some ((Ok x), a) -> Some ((Ok x), a) > | Some ((Error x), a) -> > trace Info (fun () -> $"Eval.eval / error / exception: > {x.GetType().FullName} / a: %A{a} / x: %A{x}") (fun () -> "") > Some ((Error x), a) > | _ -> None > ) > |> Option.defaultWith (fun () -> ( > let lines = lines |> SpiralSm.concat (string '\n') |> > SpiralSm.ellipsis_end 1500 > in > Error (Exception $"Eval.eval / Async.runWithTimeout / Exception / > timeout: {timeout} / timeout_continue: {timeout_continue} / lines: {lines}"), > [[| > ( > TraceLevel.Critical, $"Eval.eval / Async.runWithTimeout / > errors[[0]] / timeout: {timeout} / lines: {lines}", 0, ("", (0, 0), (0, 0)) > ) > |]] > )) 00:01:19 v #3 runtime.execute_with_options / result / { file_name = dotnet; exit_code = 0; std_trace_length = 55055 } 00:01:19 d #4 runtime.execute_with_options / { file_name = jupyter; arguments = ["nbconvert", "/home/runner/work/polyglot/polyglot/apps/spiral/Eval.dib.ipynb", "--to", "html", "--HTMLExporter.theme=dark"]; options = { command = jupyter nbconvert "/home/runner/work/polyglot/polyglot/apps/spiral/Eval.dib.ipynb" --to html --HTMLExporter.theme=dark; cancellation_token = None; environment_variables = Array(MutCell([])); on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:01:19 v #5 ! [NbConvertApp] Converting notebook /home/runner/work/polyglot/polyglot/apps/spiral/Eval.dib.ipynb to html 00:01:19 v #6 ! /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/nbformat/__init__.py:96: MissingIDFieldWarning: Cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future. 00:01:19 v #7 ! validate(nb) 00:01:20 v #8 ! /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/nbconvert/filters/highlight.py:71: UserWarning: IPython3 lexer unavailable, falling back on Python 3 00:01:20 v #9 ! return _pygments_highlight( 00:01:21 v #10 ! [NbConvertApp] Writing 467344 bytes to /home/runner/work/polyglot/polyglot/apps/spiral/Eval.dib.html 00:01:21 v #11 runtime.execute_with_options / result / { file_name = jupyter; exit_code = 0; std_trace_length = 896 } 00:01:21 d #12 spiral.process_dib / dib / jupyter nbconvert / { exit_code = 0; jupyter_result_length = 896 } 00:01:21 d #13 runtime.execute_with_options / { file_name = pwsh; arguments = ["-c", "$counter = 1; $path = '/home/runner/work/polyglot/polyglot/apps/spiral/Eval.dib.html'; (Get-Content $path -Raw) -replace '(id=\\\"cell-id=)[a-fA-F0-9]{8}', { $_.Groups[1].Value + $counter++ } | Set-Content $path"]; options = { command = pwsh -c "$counter = 1; $path = '/home/runner/work/polyglot/polyglot/apps/spiral/Eval.dib.html'; (Get-Content $path -Raw) -replace '(id=\"cell-id=)[a-fA-F0-9]{8}', { $_.Groups[1].Value + $counter++ } | Set-Content $path"; cancellation_token = None; environment_variables = Array(MutCell([])); on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:01:21 v #14 runtime.execute_with_options / result / { file_name = pwsh; exit_code = 0; std_trace_length = 0 } 00:01:21 d #15 spiral.run / dib / html cell ids / { exit_code = 0; pwsh_replace_html_result_length = 0 } 00:01:21 d #16 spiral.process_dib / dib / { exit_code = 0; result_length = 56010 } 00:00:00 d #1 writeDibCode / output: Fs / path: Eval.dib 00:00:00 d #2 parseDibCode / output: Fs / file: Eval.dib polyglot/apps/spiral/build.ps1 / $env:CI:'true'
In [ ]:
{ pwsh ../lib/fsharp/build.ps1 -sequential 1 } | Invoke-Block
00:00:00 d #1 runtime.execute_with_options_async / { file_name = ../../deps/spiral/workspace/target/release/spiral; arguments = US5_0 "dib --path Async.dib --retries 3"; options = { command = ../../deps/spiral/workspace/target/release/spiral dib --path Async.dib --retries 3; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:00:18 d #2 runtime.execute_with_options_async / { exit_code = 0; output_length = 20570; options = { command = ../../deps/spiral/workspace/target/release/spiral dib --path Async.dib --retries 3; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:00:18 d #1 Supervisor.main / executeCommand / exitCode: 0 / command: ../../deps/spiral/workspace/target/release/spiral dib --path Async.dib --retries 3 / result.Length: 20570 00:00:18 d #3 runtime.execute_with_options_async / { file_name = ../../deps/spiral/workspace/target/release/spiral; arguments = US5_0 "dib --path AsyncSeq.dib --retries 3"; options = { command = ../../deps/spiral/workspace/target/release/spiral dib --path AsyncSeq.dib --retries 3; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:00:37 d #4 runtime.execute_with_options_async / { exit_code = 0; output_length = 12327; options = { command = ../../deps/spiral/workspace/target/release/spiral dib --path AsyncSeq.dib --retries 3; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:00:37 d #2 Supervisor.main / executeCommand / exitCode: 0 / command: ../../deps/spiral/workspace/target/release/spiral dib --path AsyncSeq.dib --retries 3 / result.Length: 12327 00:00:37 d #5 runtime.execute_with_options_async / { file_name = ../../deps/spiral/workspace/target/release/spiral; arguments = US5_0 "dib --path Common.dib --retries 3"; options = { command = ../../deps/spiral/workspace/target/release/spiral dib --path Common.dib --retries 3; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:00:54 d #6 runtime.execute_with_options_async / { exit_code = 0; output_length = 5968; options = { command = ../../deps/spiral/workspace/target/release/spiral dib --path Common.dib --retries 3; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:00:54 d #3 Supervisor.main / executeCommand / exitCode: 0 / command: ../../deps/spiral/workspace/target/release/spiral dib --path Common.dib --retries 3 / result.Length: 5968 00:00:54 d #7 runtime.execute_with_options_async / { file_name = ../../deps/spiral/workspace/target/release/spiral; arguments = US5_0 "dib --path CommonFSharp.dib --retries 3"; options = { command = ../../deps/spiral/workspace/target/release/spiral dib --path CommonFSharp.dib --retries 3; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:01:11 d #8 runtime.execute_with_options_async / { exit_code = 0; output_length = 4850; options = { command = ../../deps/spiral/workspace/target/release/spiral dib --path CommonFSharp.dib --retries 3; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:01:11 d #4 Supervisor.main / executeCommand / exitCode: 0 / command: ../../deps/spiral/workspace/target/release/spiral dib --path CommonFSharp.dib --retries 3 / result.Length: 4850 00:01:11 d #9 runtime.execute_with_options_async / { file_name = ../../deps/spiral/workspace/target/release/spiral; arguments = US5_0 "dib --path FileSystem.dib --retries 3"; options = { command = ../../deps/spiral/workspace/target/release/spiral dib --path FileSystem.dib --retries 3; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:01:46 d #10 runtime.execute_with_options_async / { exit_code = 0; output_length = 87522; options = { command = ../../deps/spiral/workspace/target/release/spiral dib --path FileSystem.dib --retries 3; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:01:46 d #5 Supervisor.main / executeCommand / exitCode: 0 / command: ../../deps/spiral/workspace/target/release/spiral dib --path FileSystem.dib --retries 3 / result.Length: 87522 00:01:46 d #11 runtime.execute_with_options_async / { file_name = ../../deps/spiral/workspace/target/release/spiral; arguments = US5_0 "dib --path Runtime.dib --retries 3"; options = { command = ../../deps/spiral/workspace/target/release/spiral dib --path Runtime.dib --retries 3; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:02:04 d #12 runtime.execute_with_options_async / { exit_code = 0; output_length = 9778; options = { command = ../../deps/spiral/workspace/target/release/spiral dib --path Runtime.dib --retries 3; cancellation_token = Some System.Threading.CancellationToken; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:02:04 d #6 Supervisor.main / executeCommand / exitCode: 0 / command: ../../deps/spiral/workspace/target/release/spiral dib --path Runtime.dib --retries 3 / result.Length: 9778 00:00:00 d #1 writeDibCode / output: Fs / path: CommonFSharp.dib 00:00:00 d #1 writeDibCode / output: Fs / path: Async.dib 00:00:00 d #1 writeDibCode / output: Fs / path: AsyncSeq.dib 00:00:00 d #1 writeDibCode / output: Fs / path: Common.dib 00:00:00 d #2 parseDibCode / output: Fs / file: CommonFSharp.dib 00:00:00 d #2 parseDibCode / output: Fs / file: Async.dib 00:00:00 d #4 parseDibCode / output: Fs / file: Common.dib 00:00:00 d #5 parseDibCode / output: Fs / file: AsyncSeq.dib 00:00:00 d #6 writeDibCode / output: Fs / path: FileSystem.dib 00:00:00 d #7 writeDibCode / output: Fs / path: Runtime.dib 00:00:00 d #8 parseDibCode / output: Fs / file: FileSystem.dib 00:00:00 d #9 parseDibCode / output: Fs / file: Runtime.dib
In [ ]:
{ pwsh ../deps/spiral/apps/wasm/build.ps1 -SkipFsx 1 } | Invoke-Block
00:00:00 d #1 persistCodeProject / packages: [Fable.Core] / modules: [deps/spiral/lib/spiral/common.fsx; deps/spiral/lib/spiral/sm.fsx; deps/spiral/lib/spiral/crypto.fsx; ... ] / name: spiral_wasm / hash: / code.Length: 375569 spiral/lib/spiral/lib.ps1/GetTargetDir / targetDir: /home/runner/work/polyglot/polyglot/target/Builder/spiral_wasm polyglot/scripts/core.ps1/ResolveLink #4 / Path: /home/runner/work/polyglot/polyglot/deps/spiral/deps/polyglot/deps/spiral/lib/spiral/../../deps/polyglot / parent_target: / path_target: /home/runner/work/polyglot/polyglot / parent: /home/runner/work/polyglot/polyglot/deps/spiral/deps/polyglot/deps/spiral/lib/spiral/../../deps / End: polyglot spiral/lib/spiral/lib.ps1/BuildFable / TargetDir: /home/runner/work/polyglot/polyglot/target/Builder/spiral_wasm / ProjectName: spiral_wasm / Language: rs / Runtime: / root: /home/runner/work/polyglot/polyglot Fable 5.0.0-alpha.9: F# to Rust compiler (status: alpha) Thanks to the contributor! @damonmcminn Stand with Ukraine! https://standwithukraine.com.ua/ Parsing target/Builder/spiral_wasm/spiral_wasm.fsproj... Project and references (14 source files) parsed in 3420ms Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.JSInterop.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Routing.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Routing.Abstractions.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Mvc.ViewFeatures.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Mvc.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Mvc.Core.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Http.Abstractions.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Components.Forms.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Components.Endpoints.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Components.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Started Fable compilation... Fable compilation finished in 9934ms ./deps/spiral/lib/spiral/common.fsx(2339,0): (2339,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/sm.fsx(561,0): (561,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/async_.fsx(252,0): (252,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/threading.fsx(139,0): (139,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/crypto.fsx(2569,0): (2569,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/date_time.fsx(2553,0): (2553,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/platform.fsx(122,0): (122,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/networking.fsx(5637,0): (5637,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/trace.fsx(2897,0): (2897,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/runtime.fsx(9581,0): (9581,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/file_system.fsx(21240,0): (21240,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! warning: /home/runner/work/polyglot/spiral/apps/wasm/Cargo.toml: the cargo feature `edition2024` has been stabilized in the 1.85 release and is no longer necessary to be listed in the manifest See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature. warning: /home/runner/work/polyglot/spiral/apps/spiral/Cargo.toml: the cargo feature `edition2024` has been stabilized in the 1.85 release and is no longer necessary to be listed in the manifest See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature. Checking spiral_lib v0.0.1 (/home/runner/work/polyglot/spiral/lib/spiral) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./trace.rs (18 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./file_system.rs (180 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./sm.rs (11 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./crypto.rs (17 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs (229 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./common.rs (18 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./networking.rs (54 fixes) warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1382:17 | 1382 | / break '_method34 1383 | | { 1384 | | let v176: Runtime::US8 = 1385 | | if string("") == (v1.get().clone()) { ... | 1467 | | } ; | |______________________^ | = note: `#[warn(break_with_label_and_loop)]` on by default help: wrap this expression in parentheses | 1383 ~ ({ 1384 | let v176: Runtime::US8 = ... 1466 | } 1467 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1646:17 | 1646 | / break '_method38 1647 | | { 1648 | | let v200: Runtime::US8 = 1649 | | if string("") == (v1.get().clone()) { ... | 1733 | | } ; | |______________________^ | help: wrap this expression in parentheses | 1647 ~ ({ 1648 | let v200: Runtime::US8 = ... 1732 | } 1733 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1801:17 | 1801 | / break '_method42 1802 | | { 1803 | | let v66: Runtime::US8 = 1804 | | if string("") == (v1.get().clone()) { ... | 1855 | | } ; | |______________________^ | help: wrap this expression in parentheses | 1802 ~ ({ 1803 | let v66: Runtime::US8 = ... 1854 | } 1855 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3277:17 | 3277 | / break '_method69 3278 | | { 3279 | | let v224: Runtime::US8 = 3280 | | if string("") == (v1.get().clone()) { ... | 3349 | | } ; | |______________________^ | help: wrap this expression in parentheses | 3278 ~ ({ 3279 | let v224: Runtime::US8 = ... 3348 | } 3349 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3685:17 | 3685 | / break '_method70 3686 | | { 3687 | | let v200: Runtime::US8 = 3688 | | if string("") == (v1.get().clone()) { ... | 3800 | | } ; | |______________________^ | help: wrap this expression in parentheses | 3686 ~ ({ 3687 | let v200: Runtime::US8 = ... 3799 | } 3800 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3828:17 | 3828 | / break '_method75 3829 | | { 3830 | | let v200: Runtime::US8 = 3831 | | if string("") == (v1.get().clone()) { ... | 3914 | | } ; | |______________________^ | help: wrap this expression in parentheses | 3829 ~ ({ 3830 | let v200: Runtime::US8 = ... 3913 | } 3914 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3927:17 | 3927 | / break '_method67 3928 | | { 3929 | | let v5: bool = string("") == (v1.get().clone()); 3930 | | let v224: Runtime::US8 = ... | 4427 | | } ; | |______________________^ | help: wrap this expression in parentheses | 3928 ~ ({ 3929 | let v5: bool = string("") == (v1.get().clone()); ... 4426 | } 4427 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./common.rs:720:17 | 720 | / break '_method8 721 | | { 722 | | let result: LrcPtr<MutCell<Common::US7>> = 723 | | refCell(Common::US7::US7_1); ... | 753 | | } ; | |______________________^ | help: wrap this expression in parentheses | 721 ~ ({ 722 | let result: LrcPtr<MutCell<Common::US7>> = ... 752 | } 753 ~ }) ; | System.Management.Automation.RemoteException warning: `spiral_lib` (lib) generated 8 warnings (run `cargo fix --lib -p spiral_lib` to apply 8 suggestions) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs (7 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./common.rs (1 fix) warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1383:21 | 1383 | ({ | ^ ... 1467 | }) ; | ^ | = note: `#[warn(unused_parens)]` on by default help: remove these parentheses | 1383 ~ { 1384 | let v176: Runtime::US8 = ... 1466 | } 1467 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1647:21 | 1647 | ({ | ^ ... 1733 | }) ; | ^ | help: remove these parentheses | 1647 ~ { 1648 | let v200: Runtime::US8 = ... 1732 | } 1733 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1802:21 | 1802 | ({ | ^ ... 1855 | }) ; | ^ | help: remove these parentheses | 1802 ~ { 1803 | let v66: Runtime::US8 = ... 1854 | } 1855 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3278:21 | 3278 | ({ | ^ ... 3349 | }) ; | ^ | help: remove these parentheses | 3278 ~ { 3279 | let v224: Runtime::US8 = ... 3348 | } 3349 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3686:21 | 3686 | ({ | ^ ... 3800 | }) ; | ^ | help: remove these parentheses | 3686 ~ { 3687 | let v200: Runtime::US8 = ... 3799 | } 3800 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3829:21 | 3829 | ({ | ^ ... 3914 | }) ; | ^ | help: remove these parentheses | 3829 ~ { 3830 | let v200: Runtime::US8 = ... 3913 | } 3914 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3928:21 | 3928 | ({ | ^ ... 4427 | }) ; | ^ | help: remove these parentheses | 3928 ~ { 3929 | let v5: bool = string("") == (v1.get().clone()); ... 4426 | } 4427 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./common.rs:721:21 | 721 | ({ | ^ ... 753 | }) ; | ^ | help: remove these parentheses | 721 ~ { 722 | let result: LrcPtr<MutCell<Common::US7>> = ... 752 | } 753 ~ } ; | System.Management.Automation.RemoteException warning: `spiral_lib` (lib test) generated 8 warnings (run `cargo fix --lib -p spiral_lib --tests` to apply 8 suggestions) Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.18s spiral/apps/wasm/build.ps1 / path: /home/runner/work/polyglot/polyglot/target/Builder/spiral_wasm/target/rs/spiral_wasm.rs spiral/apps/wasm/build.ps1 / $targetDir = /home/runner/work/polyglot/polyglot/target/Builder/spiral_wasm / $projectName: spiral_wasm / $env:CI:'true' warning: /home/runner/work/polyglot/spiral/apps/wasm/Cargo.toml: the cargo feature `edition2024` has been stabilized in the 1.85 release and is no longer necessary to be listed in the manifest See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature. warning: /home/runner/work/polyglot/spiral/apps/spiral/Cargo.toml: the cargo feature `edition2024` has been stabilized in the 1.85 release and is no longer necessary to be listed in the manifest See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature. Downloading crates ... Downloaded async-fs v1.6.0 Downloaded home v0.5.12 Downloaded indicatif v0.17.11 Downloaded near-parameters v0.23.0 Downloaded scroll_derive v0.11.1 Downloaded reed-solomon-erasure v4.0.2 Downloaded polling v2.8.0 Downloaded ref-cast-impl v1.0.25 Downloaded near_schemafy_lib v0.7.0 Downloaded opaque-debug v0.3.1 Downloaded opentelemetry-otlp v0.15.0 Downloaded opentelemetry_sdk v0.22.1 Downloaded ordered-stream v0.2.0 Downloaded password-hash v0.4.2 Downloaded near_schemafy_core v0.7.0 Downloaded near-async v0.23.0 Downloaded rustc-demangle v0.1.26 Downloaded rust_decimal v1.39.0 Downloaded zip v0.5.13 Downloaded opentelemetry v0.22.0 Downloaded wasmparser v0.211.1 Downloaded opentelemetry-proto v0.5.0 Downloaded mio v0.8.11 Downloaded near-cli-rs v0.11.1 Downloaded zbus v3.15.2 Downloaded wasmparser v0.83.0 Downloaded openssl-sys v0.9.110 Downloaded zvariant v3.15.2 Downloaded near-sdk v5.11.0 Downloaded serde_yaml v0.9.34+deprecated Downloaded pdb v0.7.0 Downloaded keyring v2.3.3 Downloaded socket2 v0.4.10 Downloaded signal-hook v0.3.18 Downloaded near-account-id v1.1.4 Downloaded near-abi v0.4.3 Downloaded native-tls v0.2.14 Downloaded openssl v0.10.74 Downloaded matchit v0.7.3 Downloaded keccak v0.1.5 Downloaded io-lifetimes v1.0.11 Downloaded interactive-clap-derive v0.2.10 Downloaded zvariant_derive v3.15.2 Downloaded zstd v0.11.2+zstd.1.5.2 Downloaded zbus_macros v3.15.2 Downloaded vt100 v0.16.2 Downloaded smawk v0.3.2 Downloaded shellexpand v3.1.1 Downloaded sha2 v0.9.9 Downloaded serde_with_macros v3.15.1 Downloaded serde_repr v0.1.20 Downloaded ref-cast v1.0.25 Downloaded near-fmt v0.23.0 Downloaded near-crypto v0.23.0 Downloaded near-config-utils v0.23.0 Downloaded near-async-derive v0.23.0 Downloaded near-abi-client-macros v0.1.1 Downloaded near-abi-client-impl v0.1.1 Downloaded near-abi-client v0.1.1 Downloaded libloading v0.8.9 Downloaded jsonptr v0.4.7 Downloaded sha3 v0.10.8 Downloaded json_comments v0.2.2 Downloaded json-patch v2.0.0 Downloaded joinery v2.1.0 Downloaded zvariant_utils v1.0.1 Downloaded zstd-safe v5.0.2+zstd.1.5.2 Downloaded linux-raw-sys v0.3.8 Downloaded zbus_names v2.6.1 Downloaded xml-rs v0.8.27 Downloaded unit-prefix v0.5.1 Downloaded owo-colors v4.2.3 Downloaded ordered-float v4.6.0 Downloaded opentelemetry-semantic-conventions v0.14.0 Downloaded near-stdx v0.23.0 Downloaded near-socialdb-client v0.3.2 Downloaded near-sdk-macros v5.11.0 Downloaded near-sandbox-utils v0.9.0 Downloaded near-sandbox-utils v0.8.0 Downloaded near-rpc-error-macro v0.23.0 Downloaded near-rpc-error-core v0.23.0 Downloaded near-primitives-core v0.23.0 Downloaded proc-macro-error v1.0.4 Downloaded proc-macro-crate v3.4.0 Downloaded prettytable v0.10.0 Downloaded plain v0.2.3 Downloaded pin-project-internal v1.1.10 Downloaded near-workspaces v0.11.1 Downloaded near-time v0.23.0 Downloaded near-sys v0.2.5 Downloaded memmap2 v0.5.10 Downloaded interactive-clap v0.2.10 Downloaded xdg-home v1.3.0 Downloaded waker-fn v1.2.0 Downloaded ureq v2.12.1 Downloaded unicode-linebreak v0.1.5 Downloaded uint v0.9.5 Downloaded tracing-opentelemetry v0.23.0 Downloaded tracing-indicatif v0.3.13 Downloaded tracing-error v0.2.1 Downloaded tonic v0.11.0 Downloaded symbolic-common v8.8.0 Downloaded proc-macro-error-attr v1.0.4 Downloaded proc-macro-crate v1.3.1 Downloaded primitive-types v0.10.1 Downloaded prettyplease v0.1.25 Downloaded pbkdf2 v0.11.0 Downloaded near-token v0.3.2 Downloaded near-token v0.2.1 Downloaded protobuf v2.28.0 Downloaded prometheus v0.13.4 Downloaded nix v0.26.4 Downloaded near-chain-configs v0.23.0 Downloaded memoffset v0.7.1 Downloaded is-terminal v0.4.17 Downloaded uriparse v0.6.4 Downloaded toml_edit v0.23.7 Downloaded toml_datetime v0.7.3 Downloaded term v0.7.0 Downloaded strum v0.24.1 Downloaded string_cache v0.8.9 Downloaded socket2 v0.5.10 Downloaded serde_with v3.15.1 Downloaded prost v0.12.6 Downloaded object v0.37.3 Downloaded num-bigint v0.3.3 Downloaded near-primitives v0.23.0 Downloaded near-o11y v0.23.0 Downloaded near-jsonrpc-client v0.10.1 Downloaded near-gas v0.3.2 Downloaded urlencoding v2.1.3 Downloaded tokio-retry v0.3.0 Downloaded prost-derive v0.12.6 Downloaded num-rational v0.3.2 Downloaded num-iter v0.1.45 Downloaded newline-converter v0.3.0 Downloaded vte v0.15.0 Downloaded uuid v0.8.2 Downloaded tokio-io-timeout v1.2.1 Downloaded hyper v0.14.32 Downloaded num-rational v0.4.2 Downloaded num-complex v0.4.6 Downloaded num v0.4.3 Downloaded near-performance-metrics v0.23.0 Downloaded near-gas v0.2.5 Downloaded webpki-roots v0.26.11 Downloaded toml_parser v1.0.4 Downloaded tempfile v3.23.0 Downloaded sync_wrapper v0.1.2 Downloaded symbolic-debuginfo v8.8.0 Downloaded strum_macros v0.24.3 Downloaded smart-default v0.7.1 Downloaded smart-default v0.6.0 Downloaded slipped10 v0.4.6 Downloaded signal-hook-mio v0.2.4 Downloaded secret-service v3.1.0 Downloaded secp256k1-sys v0.8.2 Downloaded indexmap v1.9.3 Downloaded http-body v0.4.6 Downloaded gimli v0.32.3 Downloaded gimli v0.26.2 Downloaded darling_core v0.20.11 Downloaded bitcoin-internals v0.2.0 Downloaded bip39 v2.2.0 Downloaded axum v0.6.20 Downloaded near-sandbox-utils v0.15.0 Downloaded tracing-appender v0.2.3 Downloaded textwrap v0.16.2 Downloaded indenter v0.3.4 Downloaded hmac v0.9.0 Downloaded hex-conservative v0.1.2 Downloaded h2 v0.3.27 Downloaded futures-lite v1.13.0 Downloaded fluent-uri v0.1.4 Downloaded fastrand v1.9.0 Downloaded event-listener v2.5.3 Downloaded enumflags2_derive v0.7.12 Downloaded encode_unicode v1.0.0 Downloaded easy-ext v1.0.2 Downloaded dirs v6.0.0 Downloaded derive_arbitrary v1.4.2 Downloaded darling v0.21.3 Downloaded base64ct v1.8.0 Downloaded atty v0.2.14 Downloaded async-stream-impl v0.3.6 Downloaded async-lock v2.8.0 Downloaded pin-project v1.1.10 Downloaded secp256k1 v0.27.0 Downloaded schemars v1.0.4 Downloaded schemars v0.9.0 Downloaded rustversion v1.0.22 Downloaded rustix v0.37.28 Downloaded inquire v0.7.5 Downloaded indicatif v0.18.1 Downloaded ident_case v1.0.1 Downloaded hyper-timeout v0.4.1 Downloaded http v0.2.12 Downloaded heck v0.4.1 Downloaded goblin v0.5.4 Downloaded glob v0.3.3 Downloaded fuzzy-matcher v0.3.7 Downloaded fallible-iterator v0.2.0 Downloaded enumflags2 v0.7.12 Downloaded elementtree v0.7.0 Downloaded ed25519-dalek v2.2.0 Downloaded ed25519 v2.2.3 Downloaded dmsort v1.0.2 Downloaded digest v0.9.0 Downloaded darling_macro v0.21.3 Downloaded darling_core v0.21.3 Downloaded curve25519-dalek-derive v0.1.1 Downloaded block-buffer v0.9.0 Downloaded blake2 v0.10.6 Downloaded axum-core v0.3.4 Downloaded async-stream v0.3.6 Downloaded async-recursion v1.1.1 Downloaded names v0.14.0 Downloaded scroll v0.11.0 Downloaded fs2 v0.4.3 Downloaded easy-ext v0.2.9 Downloaded dirs v5.0.1 Downloaded derivative v2.2.0 Downloaded darling_macro v0.20.11 Downloaded cargo_metadata v0.18.1 Downloaded cargo-near v0.6.4 Downloaded brownstone v1.1.0 Downloaded bitcoin_hashes v0.13.0 Downloaded binary-install v0.2.0 Downloaded nom-supreme v0.6.0 Downloaded new_debug_unreachable v1.0.6 Downloaded linux-keyutils v0.2.4 Downloaded enum-map v2.7.3 Downloaded darling v0.20.11 Downloaded curve25519-dalek v4.1.3 Downloaded crypto-mac v0.9.1 Downloaded crypto-hash v0.3.4 Downloaded convert_case v0.5.0 Downloaded console v0.16.1 Downloaded colored v2.2.0 Downloaded color-eyre v0.6.5 Downloaded bs58 v0.5.1 Downloaded borsh v1.5.7 Downloaded async-io v1.13.0 Downloaded csv v1.4.0 Downloaded color-spantrace v0.3.0 Downloaded borsh-derive v1.5.7 Downloaded async-broadcast v0.5.1 Downloaded actix-rt v2.11.0 Downloaded near-jsonrpc-primitives v0.23.0 Downloaded scroll v0.10.2 Downloaded crunchy v0.2.4 Downloaded constant_time_eq v0.1.5 Downloaded bytesize v1.3.3 Downloaded indent_write v2.2.0 Downloaded csv-core v0.1.13 Downloaded crossterm v0.25.0 Downloaded openssl-src v300.5.4+3.5.4 Downloaded cargo-util v0.1.2 Downloaded backtrace v0.3.76 Downloaded async-executor v1.13.3 Downloaded addr2line v0.25.1 Downloaded actix_derive v0.6.2 Downloaded actix-macros v0.2.4 Downloaded actix v0.13.5 Downloaded Inflector v0.11.4 Downloaded hex v0.3.2 Downloaded fixed-hash v0.7.0 Downloaded enum-map-derive v0.17.0 Downloaded debugid v0.7.3 Downloaded bs58 v0.4.0 Downloaded arbitrary v1.4.2 Compiling libc v0.2.177 Compiling serde_core v1.0.228 Compiling serde v1.0.228 Compiling syn v2.0.108 Compiling version_check v0.9.5 Compiling jobserver v0.1.34 Compiling find-msvc-tools v0.1.4 Compiling shlex v1.3.0 Compiling once_cell v1.21.3 Compiling cc v1.2.43 Compiling generic-array v0.14.9 Compiling smallvec v1.15.1 Compiling futures-core v0.3.31 Compiling pkg-config v0.3.32 Compiling parking_lot_core v0.9.12 Compiling scopeguard v1.2.0 Compiling lock_api v0.4.14 Compiling bytes v1.10.1 Compiling parking_lot v0.12.5 Compiling synstructure v0.13.2 Compiling signal-hook-registry v1.4.6 Compiling log v0.4.28 Compiling getrandom v0.2.16 Compiling hashbrown v0.16.0 Compiling equivalent v1.0.2 Compiling socket2 v0.6.1 Compiling mio v1.1.0 Compiling indexmap v2.12.0 Compiling futures-sink v0.3.31 Compiling tracing-core v0.1.34 Compiling subtle v2.6.1 Compiling rand_core v0.6.4 Compiling futures-channel v0.3.31 Compiling crypto-common v0.1.6 Compiling num-traits v0.2.19 Compiling fnv v1.0.7 Compiling anyhow v1.0.100 Compiling block-buffer v0.10.4 Compiling serde_derive v1.0.228 Compiling zerofrom-derive v0.1.6 Compiling yoke-derive v0.8.0 Compiling tokio-macros v2.6.0 Compiling tokio v1.48.0 Compiling zerovec-derive v0.11.1 Compiling tracing-attributes v0.1.30 Compiling displaydoc v0.2.5 Compiling futures-macro v0.3.31 Compiling tracing v0.1.41 Compiling winnow v0.7.13 Compiling futures-util v0.3.31 Compiling cfg_aliases v0.2.1 Compiling syn v1.0.109 Compiling toml_parser v1.0.4 Compiling digest v0.10.7 Compiling toml_datetime v0.7.3 Compiling toml_edit v0.23.7 Compiling zstd-sys v2.0.16+zstd.1.5.7 Compiling rustversion v1.0.22 Compiling crossbeam-utils v0.8.21 Compiling bitflags v2.10.0 Compiling proc-macro-crate v3.4.0 Compiling borsh-derive v1.5.7 Compiling thiserror v1.0.69 Compiling thiserror-impl v1.0.69 Compiling icu_properties_data v2.0.1 Compiling icu_normalizer_data v2.0.0 Compiling lazy_static v1.5.0 Compiling rand_chacha v0.3.1 Compiling stable_deref_trait v1.2.1 Compiling byteorder v1.5.0 Compiling serde_json v1.0.145 Compiling regex-automata v0.4.13 Compiling rand v0.8.5 Compiling borsh v1.5.7 Compiling percent-encoding v2.3.2 Compiling tokio-util v0.7.16 Compiling sha2 v0.10.9 Compiling zerofrom v0.1.6 Compiling yoke v0.8.0 Compiling bitflags v1.3.2 Compiling tower-service v0.3.3 Compiling num-integer v0.1.46 Compiling httparse v1.10.1 Compiling semver v1.0.27 Compiling memchr v2.7.6 Compiling crc32fast v1.5.0 Compiling zerovec v0.11.4 Compiling hex v0.4.3 Compiling ring v0.17.14 Compiling cfg-if v1.0.4 Compiling try-lock v0.2.5 Compiling want v0.3.1 Compiling async-trait v0.1.89 Compiling typenum v1.19.0 Compiling static_assertions v1.1.0 Compiling http v0.2.12 Compiling thread_local v1.1.9 Compiling ident_case v1.0.1 Compiling tower-layer v0.3.3 Compiling powerfmt v0.2.0 Compiling deranged v0.5.5 Compiling tinystr v0.8.1 Compiling openssl-src v300.5.4+3.5.4 Compiling num_cpus v1.17.0 Compiling base64 v0.22.1 Compiling vcpkg v0.2.15 Compiling writeable v0.6.1 Compiling time-core v0.1.6 Compiling num-conv v0.1.0 Compiling litemap v0.8.0 Compiling openssl-sys v0.9.110 Compiling icu_locale_core v2.0.0 Compiling time v0.3.44 Compiling futures-executor v0.3.31 Compiling http-body v0.4.6 Compiling potential_utf v0.1.3 Compiling aho-corasick v1.1.3 Compiling matchers v0.2.0 Compiling rustc_version v0.4.1 Compiling zerotrie v0.2.2 Compiling sharded-slab v0.1.7 Compiling crossbeam-channel v0.5.15 Compiling pin-project-internal v1.1.10 Compiling serde_repr v0.1.20 Compiling tracing-log v0.2.0 Compiling bzip2-sys v0.1.13+1.0.8 Compiling indexmap v1.9.3 Compiling num-bigint v0.3.3 Compiling base64 v0.21.7 Compiling zstd-safe v5.0.2+zstd.1.5.2 Compiling regex-syntax v0.8.8 Compiling nu-ansi-term v0.50.3 Compiling pin-project v1.1.10 Compiling tracing-subscriber v0.3.20 Compiling icu_provider v2.0.0 Compiling curve25519-dalek v4.1.3 Compiling icu_collections v2.0.0 Compiling h2 v0.3.27 Compiling near-account-id v1.1.4 Compiling axum-core v0.3.4 Compiling num-rational v0.3.2 Compiling socket2 v0.5.10 Compiling convert_case v0.4.0 Compiling zeroize v1.8.2 Compiling mime v0.3.17 Compiling adler2 v2.0.1 Compiling crunchy v0.2.4 Compiling simd-adler32 v0.3.7 Compiling hashbrown v0.12.3 Compiling httpdate v1.0.3 Compiling either v1.15.0 Compiling itertools v0.12.1 Compiling hyper v0.14.32 Compiling miniz_oxide v0.8.9 Compiling rustls-pki-types v1.12.0 Compiling derive_more v0.99.20 Compiling regex v1.12.2 Compiling axum v0.6.20 Compiling tokio-stream v0.1.17 Compiling curve25519-dalek-derive v0.1.1 Compiling derive_arbitrary v1.4.2 Compiling enum-map-derive v0.17.0 Compiling secp256k1-sys v0.8.2 Compiling schemars v0.8.22 Compiling signature v2.2.0 Compiling heck v0.5.0 Compiling heck v0.4.1 Compiling urlencoding v2.1.3 Compiling bs58 v0.4.0 Compiling rustls v0.23.34 Compiling opentelemetry v0.22.0 Compiling strum_macros v0.24.3 Compiling ed25519 v2.2.3 Compiling arbitrary v1.4.2 Compiling enum-map v2.7.3 Compiling icu_normalizer v2.0.0 Compiling icu_properties v2.0.1 Compiling prost-derive v0.12.6 Compiling tower v0.4.13 Compiling concurrent-queue v2.5.0 Compiling tokio-io-timeout v1.2.1 Compiling ordered-float v4.6.0 Compiling async-stream-impl v0.3.6 Compiling http v1.3.1 Compiling block-padding v0.3.3 Compiling serde_derive_internals v0.29.1 Compiling strsim v0.11.1 Compiling glob v0.3.3 Compiling matchit v0.7.3 Compiling sync_wrapper v0.1.2 Compiling foreign-types-shared v0.1.1 Compiling openssl v0.10.74 Compiling foreign-types v0.3.2 Compiling opentelemetry_sdk v0.22.1 Compiling darling_core v0.21.3 Compiling schemars_derive v0.8.22 Compiling inout v0.1.4 Compiling async-stream v0.3.6 Compiling hyper-timeout v0.4.1 Compiling prost v0.12.6 Compiling uint v0.9.5 Compiling idna_adapter v1.2.1 Compiling near-primitives-core v0.23.0 Compiling ed25519-dalek v2.2.0 Compiling strum v0.24.1 Compiling fixed-hash v0.7.0 Compiling form_urlencoded v1.2.2 Compiling openssl-macros v0.1.1 Compiling protobuf v2.28.0 Compiling winnow v0.5.40 Compiling json_comments v0.2.2 Compiling rustix v1.1.2 Compiling toml_datetime v0.6.11 Compiling utf8_iter v1.0.4 Compiling fastrand v2.3.0 Compiling idna v1.1.0 Compiling near-config-utils v0.23.0 Compiling primitive-types v0.10.1 Compiling toml_edit v0.19.15 Compiling secp256k1 v0.27.0 Compiling tonic v0.11.0 Compiling cipher v0.4.4 Compiling darling_macro v0.21.3 Compiling http-body v1.0.1 Compiling actix-rt v2.11.0 Compiling hmac v0.12.1 Compiling blake2 v0.10.6 Compiling actix_derive v0.6.2 Compiling actix-macros v0.2.4 Compiling proc-macro-error-attr v1.0.4 Compiling arrayvec v0.7.6 Compiling prometheus v0.13.4 Compiling linux-raw-sys v0.11.0 Compiling ryu v1.0.20 Compiling zstd-safe v7.2.4 Compiling near-stdx v0.23.0 Compiling itoa v1.0.15 Compiling near-crypto v0.23.0 Compiling clap_builder v4.5.50 Compiling actix v0.13.5 Compiling opentelemetry-proto v0.5.0 Compiling darling v0.21.3 Compiling proc-macro-crate v1.3.1 Compiling url v2.5.7 Compiling event-listener v5.4.1 Compiling clap_derive v4.5.49 Compiling futures v0.3.31 Compiling zvariant_utils v1.0.1 Compiling sha1 v0.10.6 Compiling proc-macro-error v1.0.4 Compiling reed-solomon-erasure v4.0.2 Compiling event-listener v2.5.3 Compiling unsafe-libyaml v0.2.11 Compiling cpufeatures v0.2.17 Compiling io-lifetimes v1.0.11 Compiling native-tls v0.2.14 Compiling opentelemetry-semantic-conventions v0.14.0 Compiling unicode-width v0.2.2 Compiling chrono v0.4.42 Compiling opentelemetry-otlp v0.15.0 Compiling serde_yaml v0.9.34+deprecated Compiling clap v4.5.50 Compiling event-listener-strategy v0.5.4 Compiling serde_with_macros v3.15.1 Compiling flate2 v1.1.5 Compiling aes v0.8.4 Compiling tracing-opentelemetry v0.23.0 Compiling h2 v0.4.12 Compiling tracing-appender v0.2.3 Compiling near-time v0.23.0 Compiling near-rpc-error-core v0.23.0 Compiling enumflags2_derive v0.7.12 Compiling futures-lite v2.6.1 Compiling polling v2.8.0 Compiling memoffset v0.7.1 Compiling dirs-sys-next v0.1.2 Compiling waker-fn v1.2.0 Compiling keccak v0.1.5 Compiling getrandom v0.3.4 Compiling untrusted v0.9.0 Compiling rustix v0.37.28 Compiling fastrand v1.9.0 Compiling dyn-clone v1.0.20 Compiling openssl-probe v0.1.6 Compiling itertools v0.10.5 Compiling futures-lite v1.13.0 Compiling sha3 v0.10.8 Compiling dirs-next v2.0.0 Compiling enumflags2 v0.7.12 Compiling near-rpc-error-macro v0.23.0 Compiling hyper v1.7.0 Compiling near-o11y v0.23.0 Compiling zstd v0.13.3 Compiling serde_with v3.15.1 Compiling async-channel v2.5.0 Compiling near-parameters v0.23.0 Compiling async-lock v2.8.0 Compiling zvariant_derive v3.15.2 Compiling near-performance-metrics v0.23.0 Compiling piper v0.2.4 Compiling near-fmt v0.23.0 Compiling smart-default v0.6.0 Compiling bytesize v1.3.3 Compiling near-async-derive v0.23.0 Compiling sync_wrapper v1.0.2 Compiling async-io v1.13.0 Compiling async-fs v1.6.0 Compiling filetime v0.2.26 Compiling proc-macro2 v1.0.103 Compiling ipnet v2.11.0 Compiling signal-hook v0.3.18 Compiling base64ct v1.8.0 Compiling unicode-ident v1.0.20 Compiling option-ext v0.2.0 Compiling easy-ext v0.2.9 Compiling object v0.37.3 Compiling portable-atomic v1.11.1 Compiling owo-colors v4.2.3 Compiling linux-raw-sys v0.3.8 Compiling near-primitives v0.23.0 Compiling password-hash v0.4.2 Compiling hyper-util v0.1.17 Compiling tower v0.5.2 Compiling near-async v0.23.0 Compiling zvariant v3.15.2 Compiling blocking v1.6.2 Compiling interactive-clap-derive v0.2.10 Compiling rustls-webpki v0.103.7 Compiling Inflector v0.11.4 Compiling webpki-roots v1.0.3 Compiling http-body-util v0.1.3 Compiling num-bigint v0.4.6 Compiling socket2 v0.4.10 Compiling ahash v0.8.12 Compiling quote v1.0.41 Compiling eyre v0.6.12 Compiling gimli v0.32.3 Compiling color-spantrace v0.3.0 Compiling bitcoin-internals v0.2.0 Compiling iri-string v0.7.8 Compiling tower-http v0.6.6 Compiling addr2line v0.25.1 Compiling num-rational v0.4.2 Compiling webpki-roots v0.26.11 Compiling pbkdf2 v0.11.0 Compiling nix v0.26.4 Compiling interactive-clap v0.2.10 Compiling near-chain-configs v0.23.0 Compiling zstd v0.11.2+zstd.1.5.2 Compiling zbus_names v2.6.1 Compiling bzip2 v0.4.4 Compiling xattr v1.6.1 Compiling async-executor v1.13.3 Compiling async-broadcast v0.5.1 Compiling zbus_macros v3.15.2 Compiling vte v0.15.0 Compiling serde_urlencoded v0.7.1 Compiling tracing-error v0.2.1 Compiling num-iter v0.1.45 Compiling derivative v2.2.0 Compiling num-complex v0.4.6 Compiling async-recursion v1.1.1 Compiling digest v0.9.0 Compiling mio v0.8.11 Compiling ordered-stream v0.2.0 Compiling xdg-home v1.3.0 Compiling tinyvec_macros v0.1.1 Compiling siphasher v1.0.1 Compiling uuid v0.8.2 Compiling rustc-demangle v0.1.26 Compiling radium v0.7.0 Compiling indenter v0.3.4 Compiling constant_time_eq v0.1.5 Compiling zip v0.6.6 Compiling ureq v2.12.1 Compiling backtrace v0.3.76 Compiling phf_shared v0.11.3 Compiling tinyvec v1.10.0 Compiling zbus v3.15.2 Compiling signal-hook-mio v0.2.4 Compiling num v0.4.3 Compiling tar v0.4.44 Compiling vt100 v0.16.2 Compiling near-jsonrpc-primitives v0.23.0 Compiling near-abi v0.4.3 Compiling dirs-sys v0.5.0 Compiling uriparse v0.6.4 Compiling console v0.16.1 Compiling near_schemafy_core v0.7.0 Compiling hkdf v0.12.4 Compiling cbc v0.1.2 Compiling serde_spanned v0.6.9 Compiling scroll_derive v0.11.1 Compiling crypto-mac v0.9.1 Compiling block-buffer v0.9.0 Compiling is-docker v0.2.0 Compiling csv-core v0.1.13 Compiling fs2 v0.4.3 Compiling fallible-iterator v0.2.0 Compiling is_executable v0.1.2 Compiling siphasher v0.3.11 Compiling camino v1.2.1 Compiling unit-prefix v0.5.1 Compiling pin-project-lite v0.2.16 Compiling iana-time-zone v0.1.64 Compiling toml_write v0.1.2 Compiling unicode-segmentation v1.12.0 Compiling hex v0.3.2 Compiling opaque-debug v0.3.1 Compiling unicode-width v0.1.14 Compiling tap v1.0.1 Compiling new_debug_unreachable v1.0.6 Compiling hex-conservative v0.1.2 Compiling near-sandbox-utils v0.8.0 Compiling same-file v1.0.6 Compiling precomputed-hash v0.1.1 Compiling minimal-lexical v0.2.1 Compiling rust_decimal v1.39.0 Compiling nom v7.1.3 Compiling toml_edit v0.22.27 Compiling string_cache v0.8.9 Compiling walkdir v2.5.0 Compiling bitcoin_hashes v0.13.0 Compiling wyz v0.5.1 Compiling binary-install v0.2.0 Compiling sha2 v0.9.9 Compiling newline-converter v0.3.0 Compiling indicatif v0.18.1 Compiling scroll v0.11.0 Compiling csv v1.4.0 Compiling is-wsl v0.4.0 Compiling hmac v0.9.0 Compiling secret-service v3.1.0 Compiling near_schemafy_lib v0.7.0 Compiling dirs v6.0.0 Compiling hashbrown v0.14.5 Compiling color-eyre v0.6.5 Compiling crossterm v0.25.0 Compiling unicode-normalization v0.1.24 Compiling debugid v0.7.3 Compiling near-token v0.2.1 Compiling tempfile v3.23.0 Compiling dirs-sys v0.4.1 Compiling term v0.7.0 Compiling console v0.15.11 Compiling brownstone v1.1.0 Compiling darling_core v0.20.11 Compiling fuzzy-matcher v0.3.7 Compiling fxhash v0.2.1 Compiling linux-keyutils v0.2.4 Compiling is-terminal v0.4.17 Compiling memmap2 v0.5.10 Compiling shell-escape v0.1.5 Compiling joinery v2.1.0 Compiling encode_unicode v1.0.0 Compiling prettyplease v0.1.25 Compiling unicode-linebreak v0.1.5 Compiling number_prefix v0.4.0 Compiling smawk v0.3.2 Compiling funty v2.0.0 Compiling names v0.14.0 Compiling home v0.5.12 Compiling bs58 v0.5.1 Compiling pathdiff v0.2.3 Compiling scroll v0.10.2 Compiling indent_write v2.2.0 Compiling xml-rs v0.8.27 Compiling plain v0.2.3 Compiling goblin v0.5.4 Compiling pdb v0.7.0 Compiling elementtree v0.7.0 Compiling nom-supreme v0.6.0 Compiling bitvec v1.0.1 Compiling open v5.3.2 Compiling darling_macro v0.20.11 Compiling textwrap v0.16.2 Compiling indicatif v0.17.11 Compiling prettytable v0.10.0 Compiling symbolic-common v8.8.0 Compiling keyring v2.3.3 Compiling inquire v0.7.5 Compiling dirs v5.0.1 Compiling bip39 v2.2.0 Compiling near-abi-client-impl v0.1.1 Compiling wasmparser v0.211.1 Compiling shellexpand v3.1.1 Compiling slipped10 v0.4.6 Compiling tracing-indicatif v0.3.13 Compiling toml v0.8.23 Compiling gimli v0.26.2 Compiling near-gas v0.2.5 Compiling env_filter v0.1.4 Compiling zip v0.5.13 Compiling cargo-platform v0.1.9 Compiling linked-hash-map v0.5.6 Compiling smart-default v0.7.1 Compiling shell-words v1.1.0 Compiling easy-ext v1.0.2 Compiling near-sandbox-utils v0.9.0 Compiling jiff v0.2.15 Compiling near-sdk-macros v5.11.0 Compiling lazycell v1.3.0 Compiling wasmparser v0.83.0 Compiling dmsort v1.0.2 Compiling symbolic-debuginfo v8.8.0 Compiling env_logger v0.11.8 Compiling cargo_metadata v0.18.1 Compiling near-abi-client-macros v0.1.1 Compiling near-workspaces v0.11.1 Compiling darling v0.20.11 Compiling strum_macros v0.26.4 Compiling jsonptr v0.4.7 Compiling colored v2.2.0 Compiling atty v0.2.14 Compiling libloading v0.8.9 Compiling convert_case v0.5.0 Compiling near-sandbox-utils v0.15.0 Compiling dunce v1.0.5 Compiling strum v0.26.3 Compiling near-abi-client v0.1.1 Compiling json-patch v2.0.0 Compiling uuid v1.18.1 Compiling tokio-retry v0.3.0 Compiling near-token v0.3.2 Compiling near-gas v0.3.2 Compiling near-sys v0.2.5 Compiling near-sdk v5.11.0 Compiling fable_library_rust v0.1.0 (/home/runner/work/polyglot/spiral/deps/polyglot/lib/rust/fable/fable_modules/fable-library-rust) Compiling crypto-hash v0.3.4 Compiling cargo-util v0.1.2 Compiling tokio-native-tls v0.3.1 Compiling hyper-tls v0.6.0 Compiling reqwest v0.12.24 Compiling near-jsonrpc-client v0.10.1 Compiling near-socialdb-client v0.3.2 Compiling near-cli-rs v0.11.1 Compiling cargo-near v0.6.4 Compiling spiral_wasm v0.0.1 (/home/runner/work/polyglot/spiral/apps/wasm) Finished `release` profile [optimized] target(s) in 4m 40s
In [ ]:
{ pwsh ../lib/math/build.ps1 } | Invoke-Block
00:00:00 d #1 spiral.main / { args = Array(MutCell(["dib", "--path", "math.dib", "--retries", "2"])) } 00:00:00 d #2 runtime.execute_with_options / { file_name = dotnet; arguments = ["repl", "--exit-after-run", "--run", "/home/runner/work/polyglot/polyglot/lib/math/math.dib", "--output-path", "/home/runner/work/polyglot/polyglot/lib/math/math.dib.ipynb"]; options = { command = dotnet repl --exit-after-run --run "/home/runner/work/polyglot/polyglot/lib/math/math.dib" --output-path "/home/runner/work/polyglot/polyglot/lib/math/math.dib.ipynb"; cancellation_token = None; environment_variables = Array(MutCell([("TRACE_LEVEL", "Verbose"), ("AUTOMATION", "True")])); on_line = None; stdin = None; trace = false; working_directory = None; stderr = true } } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ # math > > ── spiral ────────────────────────────────────────────────────────────────────── > open testing > open rust.rust_operators > open rust > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## complex > > ── spiral ────────────────────────────────────────────────────────────────────── > nominal complex t = > `( > global "#if FABLE_COMPILER\n[[<Fable.Core.Erase; > Fable.Core.Emit(\"num_complex::Complex<$0>\")>]]\n#endif\ntype > num_complex_Complex<'T> = class end" > $'' : $'num_complex_Complex<`t>' > ) > > inl complex forall t. ((re : t), (im : t)) : complex t = > !\\((re, im), $'"num_complex::Complex::new($0, $1)"') > > ── spiral ────────────────────────────────────────────────────────────────────── > //// test > ///! rust -d num-complex > > complex (0f64, 0f64) > |> sm'.format' > |> sm'.from_std_string > |> _assert_eq "0+0i" > > ── [ 12.32s - return value ] ─────────────────────────────────────────────────── > │ { name = __assert_eq; expected = 0+0i } > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## re > > ── spiral ────────────────────────────────────────────────────────────────────── > inl re forall t. (c : complex t) : t = > !\\(c, $'"$0.re"') > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## im > > ── spiral ────────────────────────────────────────────────────────────────────── > inl im forall t. (c : complex t) : t = > !\\(c, $'"$0.im"') > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## complex_unbox > > ── spiral ────────────────────────────────────────────────────────────────────── > inl complex_unbox forall t. (c : complex t) = > re c, im c > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## (~.^) > > ── spiral ────────────────────────────────────────────────────────────────────── > inl (~.^) c = complex c > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## complex_eq > > ── spiral ────────────────────────────────────────────────────────────────────── > inl complex_eq forall t. (a : complex t) (b : complex t) : bool = > !\\((a, b), $'"$0 == $1"') > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## (.=) > > ── spiral ────────────────────────────────────────────────────────────────────── > inl (.=) a b = complex_eq a b > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## equable complex > > ── spiral ────────────────────────────────────────────────────────────────────── > instance equable complex t = complex_eq > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## complex_add > > ── spiral ────────────────────────────────────────────────────────────────────── > inl complex_add forall t. (a : complex t) (b : complex t) : complex t = > !\\((a, b), $'"$0 + $1"') > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## (.+) > > ── spiral ────────────────────────────────────────────────────────────────────── > inl (.+) a b = complex_add a b > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## complex_sub > > ── spiral ────────────────────────────────────────────────────────────────────── > inl complex_sub forall t. (a : complex t) (b : complex t) : complex t = > !\\((a, b), $'"$0 - $1"') > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## (.-) > > ── spiral ────────────────────────────────────────────────────────────────────── > inl (.-) a b = complex_sub a b > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## complex_mult > > ── spiral ────────────────────────────────────────────────────────────────────── > inl complex_mult forall t. (a : complex t) (b : complex t) : complex t = > !\\((a, b), $'"$0 * $1"') > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## (.*) > > ── spiral ────────────────────────────────────────────────────────────────────── > inl (.*) a b = complex_mult a b > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## complex_div > > ── spiral ────────────────────────────────────────────────────────────────────── > inl complex_div forall t. (a : complex t) (b : complex t) : complex t = > !\\((a, b), $'"$0 / $1"') > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## (./) > > ── spiral ────────────────────────────────────────────────────────────────────── > inl (./) a b = complex_div a b > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## powc > > ── spiral ────────────────────────────────────────────────────────────────────── > inl powc forall t. (s : complex t) (c : complex t) : complex t = > !\\((c, s), $'"num_complex::Complex::powc($0, $1)"') > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## (.**) > > ── spiral ────────────────────────────────────────────────────────────────────── > inl (.**) a b = powc b a > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## complex_sin > > ── spiral ────────────────────────────────────────────────────────────────────── > inl complex_sin forall t. (c : complex t) : complex t = > !\\(c, $'"$0.sin()"') > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## conj > > ── spiral ────────────────────────────────────────────────────────────────────── > inl conj forall t. (c : complex t) : complex t = > !\\(c, $'"$0.conj()"') > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## zeta > > ── spiral ────────────────────────────────────────────────────────────────────── > inl zeta log (gamma : complex f64 -> complex f64) (s : complex f64) : complex > f64 = > // inl rec zeta count gamma s = > inl rec zeta forall t {number}. > (count : t) > (gamma : complex f64 -> complex f64) > (s : complex f64) > : complex f64 > = > if log then > !\\((count, s), $'"println\!(\\\"zeta / count: {:?} / s: {:?}\\\", > $0, $1)"') > if re s > 1 then > (.^(0, 0), (am.init 10000i32 id : a i32 _)) > ||> am.fold fun acc n => > acc .+ (.^(1, 0) ./ (.^(f64 n, 0) .** s)) > else > inl gamma_term = gamma (.^(1, 0) .- s) > inl sin_term = .^(pi, 0) .* s ./ .^(2, 0) |> complex_sin > inl one_minus_s = .^(1 - re s, -(im s)) > inl mirror_term = > if re one_minus_s <= 1 > then .^(0, 0) > else > if count <= 3 > then zeta (count + 1) gamma one_minus_s > else one_minus_s > inl reflection_formula = > .^(2, 0) .* (.^(pi, 0) .** s) .* sin_term .* gamma_term .* > mirror_term > reflection_formula > join zeta 0i32 gamma s > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## bound > > ── spiral ────────────────────────────────────────────────────────────────────── > nominal bound t = > `( > backend_switch `(()) `({}) { > Fsharp = (fun () => > global "#if FABLE_COMPILER\n[[<Fable.Core.Erase; > Fable.Core.Emit(\"pyo3::Bound<$0>\")>]]\n#endif\ntype pyo3_Bound<'T> = class > end" > ) : () -> () > } > $'' : $'pyo3_Bound<`t>' > ) > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## python > > ── spiral ────────────────────────────────────────────────────────────────────── > nominal python = > `( > global "#if FABLE_COMPILER\n[[<Fable.Core.Erase; > Fable.Core.Emit(\"pyo3::Python\")>]]\n#endif\ntype pyo3_Python = class end" > $'' : $'pyo3_Python' > ) > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## pymodule > > ── spiral ────────────────────────────────────────────────────────────────────── > nominal pymodule = > `( > global "#if FABLE_COMPILER\n[[<Fable.Core.Erase; > Fable.Core.Emit(\"pyo3::types::PyModule\")>]]\n#endif\ntype pyo3_types_PyModule > = class end" > $'' : $'pyo3_types_PyModule' > ) > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## pyany > > ── spiral ────────────────────────────────────────────────────────────────────── > nominal pyany = > `( > global "#if FABLE_COMPILER\n[[<Fable.Core.Erase; > Fable.Core.Emit(\"pyo3::PyAny\")>]]\n#endif\ntype pyo3_PyAny = class end" > $'' : $'pyo3_PyAny' > ) > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## pyerr > > ── spiral ────────────────────────────────────────────────────────────────────── > nominal pyerr = > `( > global "#if FABLE_COMPILER\n[[<Fable.Core.Erase; > Fable.Core.Emit(\"pyo3::PyErr\")>]]\n#endif\ntype pyo3_PyErr = class end" > $'' : $'pyo3_PyErr' > ) > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## eval > > ── spiral ────────────────────────────────────────────────────────────────────── > inl module_from_code (py : python) (code : string) : _ (bound pymodule) _ = > inl py = join py > inl code = code |> sm'.to_std_string |> sm'.new_c_string > inl empty = "" |> sm'.to_std_string |> sm'.new_c_string > !\\(code, $'"pyo3::types::PyModule::from_code(!py, &$0, &!empty, &!empty)"') > |> resultm.map_error'' fun (x : pyerr) => x |> sm'.format' > > inl use_pyanymethods () = > global "Fable.Core.RustInterop.emitRustExpr () \");\nuse > pyo3::prelude::PyAnyMethods;\n//\"" > > inl getattr (attr : string) (module : bound pymodule) : _ (bound pyany) _ = > inl attr = join attr > inl attr = attr |> sm'.as_str > inl module = join module > use_pyanymethods () > !\\(attr, $'"!module.getattr($0)"') > |> resultm.map_error'' fun (x : pyerr) => x |> sm'.format' > > inl call forall t. (args : t) (module : bound pyany) : _ (bound pyany) _ = > inl args = join args > inl module = join module > !\($'"pyo3::prelude::PyAnyMethods::call(&!module, ((*!args).0, *(*!args).1), > None)"') > |> resultm.map_error'' fun (x : pyerr) => x |> sm'.format' > > inl extract forall t. (result : bound pyany) : _ t _ = > inl result = join result > use_pyanymethods () > !\($'"!result.extract()"') > |> resultm.map_error'' fun (x : pyerr) => x |> sm'.format' > > inl eval py code (args : pair bool (pair f64 f64)) : _ (_ f64) sm'.std_string = > inl code = > code > |> module_from_code py > |> resultm.unwrap' > inl fn = > code > |> getattr "fn" > |> resultm.unwrap' > > fn > |> call args > |> resultm.try' > |> extract > |> resultm.try' > |> complex > |> Ok > |> resultm.box > > inl call1_ log py s code = > inl code = join (a code : _ i32 _) |> sm'.concat_array "\n" > > inl s = new_pair (re s) (im s) > inl args = new_pair log s > > eval py code args > > inl call1_ log name py s line = > inl s = join s > join > ;[[ > $'$"import sys"' > $'$"import traceback"' > $'$"import re"' > $'$"count = 0"' > $'$"memory_address_pattern = re.compile(r\' at 0x[[0-9a-fA-F]]+\')"' > $'$"def trace_calls(frame, event, arg):"' > $'$" global count"' > $'$" count += 1"' > $'$" if count < 200:"' > $'$" try:"' > $'$" args = {{ k: v for k, v in frame.f_locals.items() if > frame.f_code.co_name \!= \'make_mpc\' and k not in [[\'ctx\']] and not > callable(v) }}"' > $'$" args_str = \', \'.join([[ > f\\\"{{k}}={{re.sub(memory_address_pattern, \' at 0x<?>\', repr(v))}}\\\" for k, > v in args.items() ]])"' > $'$" print(f\\\"{{event}}({!name}) / f_code.co_name: > {{frame.f_code.co_name}} / f_locals: {{args_str}} / f_lineno: {{frame.f_lineno}} > / f_code.co_filename: > {{frame.f_code.co_filename.split(\'site-packages\')[[-1]]}} / f_back.f_lineno: > {{ \'\' if frame.f_back is None else frame.f_back.f_lineno }} / > f_back.f_code.co_filename: {{ \'\' if frame.f_back is None else > frame.f_back.f_code.co_filename.split(\'site-packages\')[[-1]] }} / arg: > {{re.sub(memory_address_pattern, \' at 0x<?>\', repr(arg))}}\\\", flush=True)"' > $'$" except ValueError as e:"' > $'$" print(f\'{!name} / e: {{e}}\', flush=True)"' > $'$" return trace_calls"' > $'$"import mpmath"' > $'$"def fn(log, s):"' > $'$" global count"' > $'$" if log:"' > $'$" print(f\'{!name} / s: {{s}} / count: {{count}}\', > flush=True)"' > $'$" s = complex(*s)"' > $'$" try:"' > $'$" if log: sys.settrace(trace_calls)"' > line > $'$" if log:"' > $'$" sys.settrace(None)"' > $'$" print(f\'{!name} / result: {{s}} / count: > {{count}}\', flush=True)"' > $'$" except ValueError as e:"' > $'$" if s.real == 1:"' > $'$" s = complex(float(\'inf\'), 0)"' > $'$" return (s.real, s.imag)"' > ]] > |> call1_ log py s > > inl gamma_ log py s = > call1_ log "gamma_" py s $'$" s = mpmath.gamma(s)"' > > inl zeta_ log py s = > call1_ log "zeta_" py s $'$" s = mpmath.zeta(s)"' > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## run_test > > ── spiral ────────────────────────────────────────────────────────────────────── > inl run_test log (fn : (complex f64 -> complex f64) * (complex f64 -> complex > f64) -> ()) = > inl fn_ (py : python) : resultm.result' () pyerr = > inl nan () = > !\($'"f64::NAN"') > inl gamma__ = fun (s : complex f64) => > inl result = gamma_ log py s > if log then > inl s = join s > !\($'"println\!(\\\"gamma__ / s: {:?} / result: {:?}\\\", !s, > !result)"') > result |> resultm.ok' |> optionm'.unbox |> optionm'.default_value > .^(nan (), nan ()) > inl zeta__ = fun (s : complex f64) => > inl result = zeta_ log py s > > inl z = zeta true gamma__ s > > if log then > inl s = join s > !\($'"println\!(\\\"zeta__ / s: {:?} / result: {:?} / z: > {:?}\\\", !s, !result, !z)"') > > // re result - re x |> abs > // |> _assert_lt 0.001 > > // im result - im x |> abs > // |> _assert_lt 0.001 > > result |> resultm.ok' |> optionm'.unbox |> optionm'.default_value > .^(nan (), nan ()) > join fn (zeta__, gamma__) > > Ok () > |> resultm.box > > join > !\($'"pyo3::Python::initialize()"') : () > > !\($'"let __run_test = pyo3::Python::attach(|py| -> pyo3::PyResult<()> { > //"') > > let x' = fn_ (!\($'"py"') : python) > inl x' = join x' > > inl closure_fix = 2u8, 1u8 > x' |> rust.fix_closure closure_fix > > (!\($'"__run_test"') : _ () pyerr) > |> resultm.unwrap' > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## test_zeta_at_known_values_ > > ── spiral ────────────────────────────────────────────────────────────────────── > inl test_zeta_at_known_values_ log = run_test log fun zeta, gamma => > ;[[ > .^(2, 0), pi ** 2 / 6 > .^(-1, 0), -1 / 12 > ]] > |> fun x => a x : _ i32 _ > |> am.iter fun s, e => > inl result = zeta s > > result |> im |> _assert_eq 0 > re result - e |> abs |> _assert_lt 0.0001 > > ── spiral ────────────────────────────────────────────────────────────────────── > //// test > ///! rust -d num-complex pyo3='=0.26.0' > > test_zeta_at_known_values_ true > > ── [ 16.82s - return value ] ─────────────────────────────────────────────────── > │ zeta_ / s: (2.0, 0.0) / count: 0 > │ call(zeta_) / f_code.co_name: zeta / f_locals: s=(2+0j), a=1, > derivative=0, method=None, kwargs={} / f_lineno: 528 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2+0j), a=1, > derivative=0, method=None, kwargs={} / f_lineno: 530 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2+0j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 531 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2+0j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 532 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2+0j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 533 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ call(zeta_) / f_code.co_name: f / f_locals: x=(2+0j), > kwargs={}, name='zeta' / f_lineno: 989 / f_code.co_filename: > /mpmath/ctx_mp_python.py / f_back.f_lineno: 533 / f_back.f_code.co_filename: > /mpmath/functions/zeta.py / arg: None > │ line(zeta_) / f_code.co_name: f / f_locals: x=...c / > f_locals: / f_lineno: 603 / f_code.co_filename: /mpmath/ctx_mp_python.py / > f_back.f_lineno: 1007 / f_back.f_code.co_filename: /mpmath/ctx_mp_python.py / > arg: None > │ line(gamma_) / f_code.co_name: make_mpc / f_locals: / > f_lineno: 604 / f_code.co_filename: /mpmath/ctx_mp_python.py / f_back.f_lineno: > 1007 / f_back.f_code.co_filename: /mpmath/ctx_mp_python.py / arg: None > │ line(gamma_) / f_code.co_name: make_mpc / f_locals: / > f_lineno: 605 / f_code.co_filename: /mpmath/ctx_mp_python.py / f_back.f_lineno: > 1007 / f_back.f_code.co_filename: /mpmath/ctx_mp_python.py / arg: None > │ return(gamma_) / f_code.co_name: make_mpc / f_locals: / > f_lineno: 605 / f_code.co_filename: /mpmath/ctx_mp_python.py / f_back.f_lineno: > 1007 / f_back.f_code.co_filename: /mpmath/ctx_mp_python.py / arg: > mpc(real='1.0', imag='0.0') > │ return(gamma_) / f_code.co_name: f / f_locals: > x=mpc(real='2.0', imag='0.0'), kwargs={}, name='gamma', prec=53, rounding='n' / > f_lineno: 1007 / f_code.co_filename: /mpmath/ctx_mp_python.py / f_back.f_lineno: > 25 / f_back.f_code.co_filename: <string> / arg: mpc(real='1.0', imag='0.0') > │ gamma_ / result: (1.0 + 0.0j) / count: 140 > │ gamma__ / s: Complex { re: 2.0, im: 0.0 } / result: > Ok(Complex { re: 1.0, im: 0.0 }) > │ zeta / count: 1 / s: Complex { re: 2.0, im: -0.0 } > │ zeta__ / s: Complex { re: -1.0, im: 0.0 } / result: > Ok(Complex { re: -0.08333333333333333, im: 0.0 }) / z: Complex { re: NaN, im: > NaN } > │ { name = __assert_eq; expected = +0.000000 } > │ { name = __assert_lt; expected = +0.000100 } > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## test_zeta_at_2_minus2 > > ── spiral ────────────────────────────────────────────────────────────────────── > inl test_zeta_at_2_minus2 log = run_test log fun zeta, gamma => > inl s = .^(2, -2) > inl result = zeta s > > (re result - 0.8673) |> abs |> _assert_lt 0.001 > (im result - 0.2750) |> abs |> _assert_lt 0.001 > > ── spiral ────────────────────────────────────────────────────────────────────── > //// test > ///! rust -d num-complex pyo3='=0.26.0' > > test_zeta_at_2_minus2 true > > ── [ 7.20s - return value ] ──────────────────────────────────────────────────── > │ zeta_ / s: (2.0, -2.0) / count: 0 > │ call(zeta_) / f_code.co_name: zeta / f_locals: s=(2-2j), a=1, > derivative=0, method=None, kwargs={} / f_lineno: 528 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2-2j), a=1, > derivative=0, method=None, kwargs={} / f_lineno: 530 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2-2j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 531 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2-2j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 532 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2-2j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 533 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ call(zeta_) / f_code.co_name: f / f_locals: x=(2-2j), > kwargs={}, name='zeta' / f_lineno: 989 / f_code.co_filename: > /mpmath/ctx_mp_python.py / f_back.f_lineno: 533 / f_back.f_code.co_filename: > /mpmath/functions/zeta.py / arg: None > │ line(zeta_) / f_code.co_name: f / f_locals: x...filename: > /mpmath/libmp/libmpf.py / arg: None > │ call(zeta_) / f_code.co_name: python_bitcount / f_locals: n=2 > / f_lineno: 91 / f_code.co_filename: /mpmath/libmp/libintmath.py / > f_back.f_lineno: 778 / f_back.f_code.co_filename: /mpmath/libmp/libmpf.py / arg: > None > │ line(zeta_) / f_code.co_name: python_bitcount / f_locals: n=2 > / f_lineno: 93 / f_code.co_filename: /mpmath/libmp/libintmath.py / > f_back.f_lineno: 778 / f_back.f_code.co_filename: /mpmath/libmp/libmpf.py / arg: > None > │ line(zeta_) / f_code.co_name: python_bitcount / f_locals: > n=2, bc=2 / f_lineno: 94 / f_code.co_filename: /mpmath/libmp/libintmath.py / > f_back.f_lineno: 778 / f_back.f_code.co_filename: /mpmath/libmp/libmpf.py / arg: > None > │ line(zeta_) / f_code.co_name: python_bitcount / f_locals: > n=2, bc=2 / f_lineno: 95 / f_code.co_filename: /mpmath/libmp/libintmath.py / > f_back.f_lineno: 778 / f_back.f_code.co_filename: /mpmath/libmp/libmpf.py / arg: > None > │ return(zeta_) / f_code.co_name: python_bitcount / f_locals: > n=2, bc=2 / f_lineno: 95 / f_code.co_filename: /mpmath/libmp/libintmath.py / > f_back.f_lineno: 778 / f_back.f_code.co_filename: /mpmath/libmp/libmpf.py / arg: > 2 > │ zeta_ / result: (0.867351829635993 + 0.275127238807858j) / > count: 1812 > │ zeta / count: 0 / s: Complex { re: 2.0, im: -2.0 } > │ zeta__ / s: Complex { re: 2.0, im: -2.0 } / result: > Ok(Complex { re: 0.8673518296359931, im: 0.27512723880785767 }) / z: Complex { > re: NaN, im: NaN } > │ { name = __assert_lt; expected = +0.001000 } > │ { name = __assert_lt; expected = +0.001000 } > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## test_trivial_zero_at_negative_even___ > > ── spiral ────────────────────────────────────────────────────────────────────── > inl test_trivial_zero_at_negative_even___ log = run_test log fun zeta, gamma => > (join listm'.init_series -2f64 -40 -2) > |> listm.iter fun n => > inl s = .^(n, 0) > inl result = zeta s > > result |> re |> _assert_eq 0 > result |> im |> _assert_eq 0 > > ── spiral ────────────────────────────────────────────────────────────────────── > //// test > ///! rust -d num-complex pyo3='=0.26.0' > > test_trivial_zero_at_negative_even___ true > > ── [ 7.70s - return value ] ──────────────────────────────────────────────────── > │ zeta_ / s: (-2.0, 0.0) / count: 0 > │ call(zeta_) / f_code.co_name: zeta / f_locals: s=(-2+0j), > a=1, derivative=0, method=None, kwargs={} / f_lineno: 528 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(-2+0j), > a=1, derivative=0, method=None, kwargs={} / f_lineno: 530 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(-2+0j), > a=1, derivative=0, method=None, kwargs={}, d=0 / f_lineno: 531 / > f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(-2+0j), > a=1, derivative=0, method=None, kwargs={}, d=0 / f_lineno: 532 / > f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(-2+0j), > a=1, derivative=0, method=None, kwargs={}, d=0 / f_lineno: 533 / > f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ call(zeta_) / f_code.co_name: f / f_locals: x=(-2+0j), > kwargs={}, name='zeta' / f_lineno: 989 / f_code.co_filename: > /mpmath/ctx_mp_python.py / f_back.f_lineno: 533 / f_back.f_code.co_filename: > /mpmath/functions/zeta.py / arg: None > │ line(zeta_) / f_code.co_name: f / f_loc...h/ctx_mp_python.py > / f_back.f_lineno: 1007 / f_back.f_code.co_filename: /mpmath/ctx_mp_python.py / > arg: None > │ line(gamma_) / f_code.co_name: make_mpc / f_locals: / > f_lineno: 604 / f_code.co_filename: /mpmath/ctx_mp_python.py / f_back.f_lineno: > 1007 / f_back.f_code.co_filename: /mpmath/ctx_mp_python.py / arg: None > │ line(gamma_) / f_code.co_name: make_mpc / f_locals: / > f_lineno: 605 / f_code.co_filename: /mpmath/ctx_mp_python.py / f_back.f_lineno: > 1007 / f_back.f_code.co_filename: /mpmath/ctx_mp_python.py / arg: None > │ return(gamma_) / f_code.co_name: make_mpc / f_locals: / > f_lineno: 605 / f_code.co_filename: /mpmath/ctx_mp_python.py / f_back.f_lineno: > 1007 / f_back.f_code.co_filename: /mpmath/ctx_mp_python.py / arg: > mpc(real='8.1591528324789768e+47', imag='0.0') > │ return(gamma_) / f_code.co_name: f / f_locals: > x=mpc(real='41.0', imag='0.0'), kwargs={}, name='gamma', prec=53, rounding='n' / > f_lineno: 1007 / f_code.co_filename: /mpmath/ctx_mp_python.py / f_back.f_lineno: > 25 / f_back.f_code.co_filename: <string> / arg: > mpc(real='8.1591528324789768e+47', imag='0.0') > │ gamma_ / result: (8.15915283247898e+47 + 0.0j) / count: 149 > │ gamma__ / s: Complex { re: 41.0, im: 0.0 } / result: > Ok(Complex { re: 8.159152832478977e47, im: 0.0 }) > │ zeta / count: 1 / s: Complex { re: 41.0, im: -0.0 } > │ zeta__ / s: Complex { re: -40.0, im: 0.0 } / result: > Ok(Complex { re: 0.0, im: 0.0 }) / z: Complex { re: NaN, im: NaN } > │ { name = __assert_eq; expected = +0.000000 } > │ { name = __assert_eq; expected = +0.000000 } > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## test_non_trivial_zero___ > > ── spiral ────────────────────────────────────────────────────────────────────── > inl test_non_trivial_zero___ log = run_test log fun zeta, gamma => > ;[[ > .^(0.5, 14.134725) > .^(0.5, 21.022040) > .^(0.5, 25.010857) > .^(0.5, 30.424876) > .^(0.5, 32.935062) > .^(0.5, 37.586178) > ]] > |> fun x => a x : _ i32 _ > |> am.iter fun x => > inl result = zeta x > result |> re |> abs |> _assert_lt 0.0001 > result |> im |> abs |> _assert_lt 0.0001 > > ── spiral ────────────────────────────────────────────────────────────────────── > //// test > ///! rust -d num-complex pyo3='=0.26.0' > > test_non_trivial_zero___ true > > ── [ 7.42s - return value ] ──────────────────────────────────────────────────── > │ zeta_ / s: (0.5, 14.134725) / count: 0 > │ call(zeta_) / f_code.co_name: zeta / f_locals: > s=(0.5+14.134725j), a=1, derivative=0, method=None, kwargs={} / f_lineno: 528 / > f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: > s=(0.5+14.134725j), a=1, derivative=0, method=None, kwargs={} / f_lineno: 530 / > f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: > s=(0.5+14.134725j), a=1, derivative=0, method=None, kwargs={}, d=0 / f_lineno: > 531 / f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: > s=(0.5+14.134725j), a=1, derivative=0, method=None, kwargs={}, d=0 / f_lineno: > 532 / f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: > s=(0.5+14.134725j), a=1, derivative=0, method=None, kwargs={}, d=0 / f_lineno: > 533 / f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ call(zeta_) / f_code.co_name: f / f_locals: > x=(0.5+14.134725j), kwargs={}, name='zeta' / f_lineno: 989 / f_code.co_filename: > /mpmath/ctx_mp_python.py / f_back.f_lineno: 533 / f_back.f_code.co_filename: > /mpmath/functions/...name: /mpmath/libmp/gammazeta.py / arg: None > │ line(gamma_) / f_code.co_name: complex_stirling_series / > f_locals: x=1208925819614629174706176, y=-90877802089662679288381440, prec=81, > _m=3416353708500640443578529333, tre=855591523614410863719, > tim=64316830603724894628746, ure=-1710577520534459139249, > uim=45518868236127668552, sre=1013002518538853602038572, > sim=90883161825546323029600502 / f_lineno: 1637 / f_code.co_filename: > /mpmath/libmp/gammazeta.py / f_back.f_lineno: 2050 / f_back.f_code.co_filename: > /mpmath/libmp/gammazeta.py / arg: None > │ line(gamma_) / f_code.co_name: complex_stirling_series / > f_locals: x=1208925819614629174706176, y=-90877802089662679288381440, prec=81, > _m=3416353708500640443578529333, tre=-1816151534455075068, > tim=-45486653225747820096, ure=-1710577520534459139249, > uim=45518868236127668552, sre=1013002518538853602038572, > sim=90883161825546323029600502 / f_lineno: 1638 / f_code.co_filename: > /mpmath/libmp/gammazeta.py / f_back.f_lineno: 2050 / f_back.f_code.co_filename: > /mpmath/libmp/gammazeta.py / arg: None > │ gamma_ / result: (-1.32798420042152e-26 + > 5.5751975252688e-26j) / count: 309 > │ gamma__ / s: Complex { re: 0.5, im: -37.586178 } / result: > Ok(Complex { re: -1.3279842004215153e-26, im: 5.575197525268802e-26 }) > │ zeta__ / s: Complex { re: 0.5, im: 37.586178 } / result: > Ok(Complex { re: -8.910186507947958e-8, im: -2.943780446402868e-7 }) / z: > Complex { re: -0.0, im: 0.0 } > │ { name = __assert_lt; expected = +0.000100 } > │ { name = __assert_lt; expected = +0.000100 } > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## test_real_part_greater_than_one___ > > ── spiral ────────────────────────────────────────────────────────────────────── > inl test_real_part_greater_than_one___ log = run_test log fun zeta, gamma => > inl points = ;[[ 2; 3; 4; 5; 10; 20; 50 ]] > (a points : _ i32 _) > |> am.iter fun point => > inl s = .^(point, 0) > inl result = zeta s > result |> re |> _assert_gt 0 > result |> im |> _assert_eq 0 > > ── spiral ────────────────────────────────────────────────────────────────────── > //// test > ///! rust -d num-complex pyo3='=0.26.0' > > test_real_part_greater_than_one___ true > > ── [ 7.34s - return value ] ──────────────────────────────────────────────────── > │ zeta_ / s: (2.0, 0.0) / count: 0 > │ call(zeta_) / f_code.co_name: zeta / f_locals: s=(2+0j), a=1, > derivative=0, method=None, kwargs={} / f_lineno: 528 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2+0j), a=1, > derivative=0, method=None, kwargs={} / f_lineno: 530 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2+0j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 531 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2+0j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 532 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2+0j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 533 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ call(zeta_) / f_code.co_name: f / f_locals: x=(2+0j), > kwargs={}, name='zeta' / f_lineno: 989 / f_code.co_filename: > /mpmath/ctx_mp_python.py / f_back.f_lineno: 533 / f_back.f_code.co_filename: > /mpmath/functions/zeta.py / arg: None > │ line(zeta_) / f_code.co_name: f / f_locals: x=... > f_code.co_filename: /mpmath/ctx_mp_python.py / f_back.f_lineno: 1007 / > f_back.f_code.co_filename: /mpmath/ctx_mp_python.py / arg: None > │ line(zeta_) / f_code.co_name: make_mpc / f_locals: / > f_lineno: 605 / f_code.co_filename: /mpmath/ctx_mp_python.py / f_back.f_lineno: > 1007 / f_back.f_code.co_filename: /mpmath/ctx_mp_python.py / arg: None > │ return(zeta_) / f_code.co_name: make_mpc / f_locals: / > f_lineno: 605 / f_code.co_filename: /mpmath/ctx_mp_python.py / f_back.f_lineno: > 1007 / f_back.f_code.co_filename: /mpmath/ctx_mp_python.py / arg: > mpc(real='1.0000000000000009', imag='0.0') > │ return(zeta_) / f_code.co_name: f / f_locals: > x=mpc(real='50.0', imag='0.0'), kwargs={}, name='zeta', prec=53, rounding='n' / > f_lineno: 1007 / f_code.co_filename: /mpmath/ctx_mp_python.py / f_back.f_lineno: > 533 / f_back.f_code.co_filename: /mpmath/functions/zeta.py / arg: > mpc(real='1.0000000000000009', imag='0.0') > │ return(zeta_) / f_code.co_name: zeta / f_locals: s=(50+0j), > a=1, derivative=0, method=None, kwargs={}, d=0 / f_lineno: 533 / > f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: mpc(real='1.0000000000000009', > imag='0.0') > │ zeta_ / result: (1.0 + 0.0j) / count: 181 > │ zeta / count: 0 / s: Complex { re: 50.0, im: 0.0 } > │ zeta__ / s: Complex { re: 50.0, im: 0.0 } / result: > Ok(Complex { re: 1.0000000000000009, im: 0.0 }) / z: Complex { re: NaN, im: NaN > } > │ { name = __assert_gt; expected = +0.000000 } > │ { name = __assert_eq; expected = +0.000000 } > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## test_zeta_at_1___ > > ── spiral ────────────────────────────────────────────────────────────────────── > inl test_zeta_at_1___ log = run_test log fun zeta, gamma => > inl s = .^(1, 0) > inl result = zeta s > result |> re |> _assert_eq limit.max > result |> im |> _assert_eq 0 > > ── spiral ────────────────────────────────────────────────────────────────────── > //// test > ///! rust -d num-complex pyo3='=0.26.0' > > test_zeta_at_1___ true > > ── [ 7.23s - return value ] ──────────────────────────────────────────────────── > │ zeta_ / s: (1.0, 0.0) / count: 0 > │ call(zeta_) / f_code.co_name: zeta / f_locals: s=(1+0j), a=1, > derivative=0, method=None, kwargs={} / f_lineno: 528 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(1+0j), a=1, > derivative=0, method=None, kwargs={} / f_lineno: 530 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(1+0j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 531 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(1+0j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 532 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(1+0j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 533 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ call(zeta_) / f_code.co_name: f / f_locals: x=(1+0j), > kwargs={}, name='zeta' / f_lineno: 989 / f_code.co_filename: > /mpmath/ctx_mp_python.py / f_back.f_lineno: 533 / f_back.f_code.co_filename: > /mpmath/functions/zeta.py / arg: None > │ line(zeta_) / f_code.co_name: f / f_locals: x=..._name: f / > f_locals: x=mpc(real='0.0', imag='0.0'), kwargs={}, name='gamma', prec=53, > rounding='n' / f_lineno: 1007 / f_code.co_filename: /mpmath/ctx_mp_python.py / > f_back.f_lineno: 25 / f_back.f_code.co_filename: <string> / arg: None > │ exception(gamma_) / f_code.co_name: fn / f_locals: log=True, > s=0j / f_lineno: 25 / f_code.co_filename: <string> / f_back.f_lineno: / > f_back.f_code.co_filename: / arg: (<class 'ValueError'>, ValueError('gamma > function pole'), <traceback object at 0x<?>>) > │ line(gamma_) / f_code.co_name: fn / f_locals: log=True, s=0j > / f_lineno: 29 / f_code.co_filename: <string> / f_back.f_lineno: / > f_back.f_code.co_filename: / arg: None > │ line(gamma_) / f_code.co_name: fn / f_locals: log=True, s=0j, > e=ValueError('gamma function pole') / f_lineno: 30 / f_code.co_filename: > <string> / f_back.f_lineno: / f_back.f_code.co_filename: / arg: None > │ line(gamma_) / f_code.co_name: fn / f_locals: log=True, s=0j > / f_lineno: 32 / f_code.co_filename: <string> / f_back.f_lineno: / > f_back.f_code.co_filename: / arg: None > │ return(gamma_) / f_code.co_name: fn / f_locals: log=True, > s=0j / f_lineno: 32 / f_code.co_filename: <string> / f_back.f_lineno: / > f_back.f_code.co_filename: / arg: (0.0, 0.0) > │ gamma__ / s: Complex { re: 0.0, im: 0.0 } / result: > Ok(Complex { re: 0.0, im: 0.0 }) > │ zeta__ / s: Complex { re: 1.0, im: 0.0 } / result: Ok(Complex > { re: inf, im: 0.0 }) / z: Complex { re: 0.0, im: 0.0 } > │ { name = __assert_eq; expected = +inf } > │ { name = __assert_eq; expected = +0.000000 } > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## test_symmetry_across_real_axis___ > > ── spiral ────────────────────────────────────────────────────────────────────── > inl test_symmetry_across_real_axis___ log = run_test log fun zeta, gamma => > inl s = .^(2, 10) > inl result_positive_im = zeta s > inl result_negative_im = zeta .^(re s, -(im s)) > inl conj = result_negative_im |> conj > result_positive_im |> re |> _assert_eq (conj |> re) > result_positive_im |> im |> _assert_eq (conj |> im) > > ── spiral ────────────────────────────────────────────────────────────────────── > //// test > ///! rust -d num-complex pyo3='=0.26.0' > > test_symmetry_across_real_axis___ true > > ── [ 7.46s - return value ] ──────────────────────────────────────────────────── > │ zeta_ / s: (2.0, 10.0) / count: 0 > │ call(zeta_) / f_code.co_name: zeta / f_locals: s=(2+10j), > a=1, derivative=0, method=None, kwargs={} / f_lineno: 528 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2+10j), > a=1, derivative=0, method=None, kwargs={} / f_lineno: 530 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2+10j), > a=1, derivative=0, method=None, kwargs={}, d=0 / f_lineno: 531 / > f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2+10j), > a=1, derivative=0, method=None, kwargs={}, d=0 / f_lineno: 532 / > f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2+10j), > a=1, derivative=0, method=None, kwargs={}, d=0 / f_lineno: 533 / > f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ call(zeta_) / f_code.co_name: f / f_locals: x=(2+10j), > kwargs={}, name='zeta' / f_lineno: 989 / f_code.co_filename: > /mpmath/ctx_mp_python.py / f_back.f_lineno: 533 / f_back.f_code.co_filename: > /mpmath/functions/zeta.py / arg: None > │ line(zeta_) / f_code.co_name: f / f_loc...ename: > /mpmath/libmp/libintmath.py / f_back.f_lineno: 778 / f_back.f_code.co_filename: > /mpmath/libmp/libmpf.py / arg: None > │ line(zeta_) / f_code.co_name: python_bitcount / f_locals: > n=26, bc=5 / f_lineno: 94 / f_code.co_filename: /mpmath/libmp/libintmath.py / > f_back.f_lineno: 778 / f_back.f_code.co_filename: /mpmath/libmp/libmpf.py / arg: > None > │ line(zeta_) / f_code.co_name: python_bitcount / f_locals: > n=26, bc=5 / f_lineno: 95 / f_code.co_filename: /mpmath/libmp/libintmath.py / > f_back.f_lineno: 778 / f_back.f_code.co_filename: /mpmath/libmp/libmpf.py / arg: > None > │ return(zeta_) / f_code.co_name: python_bitcount / f_locals: > n=26, bc=5 / f_lineno: 95 / f_code.co_filename: /mpmath/libmp/libintmath.py / > f_back.f_lineno: 778 / f_back.f_code.co_filename: /mpmath/libmp/libmpf.py / arg: > 5 > │ line(zeta_) / f_code.co_name: mpf_add / f_locals: s=(0, 1, 2, > 1), t=(0, 25, 2, 5), prec=14, rnd='d', _sub=0, ssign=0, sman=1, sexp=2, sbc=1, > tsign=0, tman=25, texp=2, tbc=5, offset=0, man=26, bc=5 / f_lineno: 779 / > f_code.co_filename: /mpmath/libmp/libmpf.py / f_back.f_lineno: 1401 / > f_back.f_code.co_filename: /mpmath/libmp/libmpf.py / arg: None > │ zeta_ / result: (1.19798250067418 + 0.0791704917205257j) / > count: 1174 > │ zeta / count: 0 / s: Complex { re: 2.0, im: -10.0 } > │ zeta__ / s: Complex { re: 2.0, im: -10.0 } / result: > Ok(Complex { re: 1.1979825006741847, im: 0.07917049172052575 }) / z: Complex { > re: NaN, im: NaN } > │ { name = __assert_eq; expected = +1.197983 } > │ { name = __assert_eq; expected = -0.079170 } > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## test_behavior_near_origin___ > > ── spiral ────────────────────────────────────────────────────────────────────── > inl test_behavior_near_origin___ log = run_test log fun zeta, gamma => > inl s = .^(0.01, 0.01) > inl result = zeta s > result |> re |> _assert_lt limit.max > result |> im |> _assert_lt limit.max > > ── spiral ────────────────────────────────────────────────────────────────────── > //// test > ///! rust -d num-complex pyo3='=0.26.0' > > test_behavior_near_origin___ true > > ── [ 7.16s - return value ] ──────────────────────────────────────────────────── > │ zeta_ / s: (0.01, 0.01) / count: 0 > │ call(zeta_) / f_code.co_name: zeta / f_locals: > s=(0.01+0.01j), a=1, derivative=0, method=None, kwargs={} / f_lineno: 528 / > f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: > s=(0.01+0.01j), a=1, derivative=0, method=None, kwargs={} / f_lineno: 530 / > f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: > s=(0.01+0.01j), a=1, derivative=0, method=None, kwargs={}, d=0 / f_lineno: 531 / > f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: > s=(0.01+0.01j), a=1, derivative=0, method=None, kwargs={}, d=0 / f_lineno: 532 / > f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: > s=(0.01+0.01j), a=1, derivative=0, method=None, kwargs={}, d=0 / f_lineno: 533 / > f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ call(zeta_) / f_code.co_name: f / f_locals: x=(0.01+0.01j), > kwargs={}, name='zeta' / f_lineno: 989 / f_code.co_filename: > /mpmath/ctx_mp_python.py / f_back.f_lineno: 533 / f_back.f_code.co_filename: > /mpmath/functions/zeta.py / arg: None > │ line(zet...co_filename: /mpmath/libmp/gammazeta.py / > f_back.f_lineno: 1007 / f_back.f_code.co_filename: /mpmath/ctx_mp_python.py / > arg: None > │ line(gamma_) / f_code.co_name: mpc_gamma / f_locals: z=((0, > 4458563631096791, -52, 52), (1, 5764607523034235, -59, 53)), prec=53, rnd='n', > type=0, a=(0, 4458563631096791, -52, 52), b=(1, 5764607523034235, -59, 53), > asign=0, aman=4458563631096791, aexp=-52, abc=52, bsign=1, > bman=5764607523034235, bexp=-59, bbc=53, wp=73, amag=0, bmag=-6, mag=0, an=0, > bn=0, absn=0j, gamma_size=0, need_reflection=0, zorig=((0, 4458563631096791, > -52, 52), (1, 5764607523034235, -59, 53)), yfinal=0, balance_prec=0, > n_for_stirling=14, need_reduction=True, afix=132131814190692672995328, > bfix=-94447329657392906240, r=0, zprered=((0, 4458563631096791, -52, 52), (1, > 5764607523034235, -59, 53)), d=14, rre=56942610883563778729574216337150, > one=9444732965739290427392, rim=-1820461636508155576115177658065, k=12 / > f_lineno: 2043 / f_code.co_filename: /mpmath/libmp/gammazeta.py / > f_back.f_lineno: 1007 / f_back.f_code.co_filename: /mpmath/ctx_mp_python.py / > arg: None > │ gamma_ / result: (1.00577030202902 + 0.0059717824054102j) / > count: 383 > │ gamma__ / s: Complex { re: 0.99, im: -0.01 } / result: > Ok(Complex { re: 1.005770302029023, im: 0.005971782405410201 }) > │ zeta__ / s: Complex { re: 0.01, im: 0.01 } / result: > Ok(Complex { re: -0.5091873433665667, im: -0.00939202213994577 }) / z: Complex { > re: 0.0, im: 0.0 } > │ { name = __assert_lt; expected = +inf } > │ { name = __assert_lt; expected = +inf } > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## test_imaginary_axis > > ── spiral ────────────────────────────────────────────────────────────────────── > inl test_imaginary_axis log = run_test log fun zeta, gamma => > (join [[ 10; 20; 30; 40; 50; 60; 70; 80; 90; 100 ]]) > |> listm.iter fun s => > inl s = .^(0, s) > inl result = zeta s > result |> re |> _assert_ne 0 > result |> im |> _assert_ne 0 > > ── spiral ────────────────────────────────────────────────────────────────────── > //// test > ///! rust -d num-complex pyo3='=0.26.0' > > test_imaginary_axis true > > ── [ 7.59s - return value ] ──────────────────────────────────────────────────── > │ zeta_ / s: (0.0, 10.0) / count: 0 > │ call(zeta_) / f_code.co_name: zeta / f_locals: s=10j, a=1, > derivative=0, method=None, kwargs={} / f_lineno: 528 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=10j, a=1, > derivative=0, method=None, kwargs={} / f_lineno: 530 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=10j, a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 531 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=10j, a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 532 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=10j, a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 533 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ call(zeta_) / f_code.co_name: f / f_locals: x=10j, kwargs={}, > name='zeta' / f_lineno: 989 / f_code.co_filename: /mpmath/ctx_mp_python.py / > f_back.f_lineno: 533 / f_back.f_code.co_filename: /mpmath/functions/zeta.py / > arg: None > │ line(zeta_) / f_code.co_name: f / f_locals: x=10j, kwargs={}, > n...libmp/gammazeta.py / arg: None > │ line(gamma_) / f_code.co_name: to_fixed / f_locals: s=(0, 1, > 0, 1), prec=83 / f_lineno: 511 / f_code.co_filename: /mpmath/libmp/libmpf.py / > f_back.f_lineno: 2031 / f_back.f_code.co_filename: /mpmath/libmp/gammazeta.py / > arg: None > │ line(gamma_) / f_code.co_name: to_fixed / f_locals: s=(0, 1, > 0, 1), prec=83, sign=0, man=1, exp=0, bc=1 / f_lineno: 512 / f_code.co_filename: > /mpmath/libmp/libmpf.py / f_back.f_lineno: 2031 / f_back.f_code.co_filename: > /mpmath/libmp/gammazeta.py / arg: None > │ line(gamma_) / f_code.co_name: to_fixed / f_locals: s=(0, 1, > 0, 1), prec=83, sign=0, man=1, exp=0, bc=1, offset=83 / f_lineno: 513 / > f_code.co_filename: /mpmath/libmp/libmpf.py / f_back.f_lineno: 2031 / > f_back.f_code.co_filename: /mpmath/libmp/gammazeta.py / arg: None > │ line(gamma_) / f_code.co_name: to_fixed / f_locals: s=(0, 1, > 0, 1), prec=83, sign=0, man=1, exp=0, bc=1, offset=83 / f_lineno: 517 / > f_code.co_filename: /mpmath/libmp/libmpf.py / f_back.f_lineno: 2031 / > f_back.f_code.co_filename: /mpmath/libmp/gammazeta.py / arg: None > │ gamma_ / result: (-1.51425318049776e-67 + > 2.79082155561748e-69j) / count: 289 > │ gamma__ / s: Complex { re: 1.0, im: -100.0 } / result: > Ok(Complex { re: -1.514253180497756e-67, im: 2.7908215556174775e-69 }) > │ zeta__ / s: Complex { re: 0.0, im: 100.0 } / result: > Ok(Complex { re: 6.51721042625301, im: 0.18128842533791736 }) / z: Complex { re: > 0.0, im: 0.0 } > │ { name = __assert_ne; expected = +0.000000 } > │ { name = __assert_ne; expected = +0.000000 } > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## test_critical_strip > > ── spiral ────────────────────────────────────────────────────────────────────── > inl test_critical_strip log = run_test log fun zeta, gamma => > (join [[ > .^(0.5, 14.134725) > .^(0.75, 20.5) > .^(1.25, 30.1) > .^(0.25, 40.0) > .^(1.0, 50.0) > ]]) > |> listm.iter fun s => > inl result = zeta s > result |> re |> _assert_ne 0 > result |> im |> _assert_ne 0 > > ── spiral ────────────────────────────────────────────────────────────────────── > //// test > ///! rust -d num-complex pyo3='=0.26.0' > > test_critical_strip true > > ── [ 7.41s - return value ] ──────────────────────────────────────────────────── > │ zeta_ / s: (0.5, 14.134725) / count: 0 > │ call(zeta_) / f_code.co_name: zeta / f_locals: > s=(0.5+14.134725j), a=1, derivative=0, method=None, kwargs={} / f_lineno: 528 / > f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: > s=(0.5+14.134725j), a=1, derivative=0, method=None, kwargs={} / f_lineno: 530 / > f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: > s=(0.5+14.134725j), a=1, derivative=0, method=None, kwargs={}, d=0 / f_lineno: > 531 / f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: > s=(0.5+14.134725j), a=1, derivative=0, method=None, kwargs={}, d=0 / f_lineno: > 532 / f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: > s=(0.5+14.134725j), a=1, derivative=0, method=None, kwargs={}, d=0 / f_lineno: > 533 / f_code.co_filename: /mpmath/functions/zeta.py / f_back.f_lineno: 25 / > f_back.f_code.co_filename: <string> / arg: None > │ call(zeta_) / f_code.co_name: f / f_locals: > x=(0.5+14.134725j), kwargs={}, name='zeta' / f_lineno: 989 / f_code.co_filename: > /mpmath/ctx_mp_python.py / f_back.f_lineno: 533 / f_back.f_code.co_filename: > /mpmath/functions/...e=4443714077719696485012210, > sim=241793223535862290161314995 / f_lineno: 1648 / f_code.co_filename: > /mpmath/libmp/gammazeta.py / f_back.f_lineno: 2050 / f_back.f_code.co_filename: > /mpmath/libmp/gammazeta.py / arg: None > │ line(gamma_) / f_code.co_name: complex_stirling_series / > f_locals: x=0, y=-241785163922925834941235200, prec=82, > _m=12089258196146291747061760000, tre=0, tim=396, ure=-1934281311383406679530, > uim=0, sre=4443714077719696485012210, sim=241793223535862290161314995 / > f_lineno: 1649 / f_code.co_filename: /mpmath/libmp/gammazeta.py / > f_back.f_lineno: 2050 / f_back.f_code.co_filename: /mpmath/libmp/gammazeta.py / > arg: None > │ line(gamma_) / f_code.co_name: complex_stirling_series / > f_locals: x=0, y=-241785163922925834941235200, prec=82, > _m=12089258196146291747061760000, tre=0, tim=396, ure=-1934281311383406679530, > uim=0, sre=4443714077719696485012210, sim=241793223535862290161314997 / > f_lineno: 1650 / f_code.co_filename: /mpmath/libmp/gammazeta.py / > f_back.f_lineno: 2050 / f_back.f_code.co_filename: /mpmath/libmp/gammazeta.py / > arg: None > │ gamma_ / result: (2.63173210619768e-35 - > 8.16464935465334e-36j) / count: 262 > │ gamma__ / s: Complex { re: 0.0, im: -50.0 } / result: > Ok(Complex { re: 2.6317321061976804e-35, im: -8.164649354653339e-36 }) > │ zeta__ / s: Complex { re: 1.0, im: 50.0 } / result: > Ok(Complex { re: 0.44103873082309397, im: 0.281582455029683 }) / z: Complex { > re: 0.0, im: 0.0 } > │ { name = __assert_ne; expected = +0.000000 } > │ { name = __assert_ne; expected = +0.000000 } > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## test_reflection_formula_for_specific_value > > ── spiral ────────────────────────────────────────────────────────────────────── > inl test_reflection_formula_for_specific_value log = run_test log fun zeta, > gamma => > (join [[ > .^(3, 4) > .^(2.5, -3.5) > .^(1.5, 2.5) > .^(0.5, 14.134725) > ]]) > |> listm.iter fun s => > inl lhs = zeta s > inl reflection_coefficient = > (.^(2, 0) .** s) > .* (.^(pi, 0) .** (s .- .^(1, 0))) > .* (.^(pi, 0) .* s ./ .^(2, 0) |> complex_sin) > .* gamma (.^(1, 0) .- s) > > inl one_minus_s = .^(1 - re s, -(im s)) > inl rhs = reflection_coefficient .* zeta one_minus_s > > re lhs - re rhs |> abs |> _assert_lt 0.0001 > im lhs - im rhs |> abs |> _assert_lt 0.0001 > > ── spiral ────────────────────────────────────────────────────────────────────── > //// test > ///! rust -d num-complex pyo3='=0.26.0' > > test_reflection_formula_for_specific_value true > > ── [ 7.71s - return value ] ──────────────────────────────────────────────────── > │ zeta_ / s: (3.0, 4.0) / count: 0 > │ call(zeta_) / f_code.co_name: zeta / f_locals: s=(3+4j), a=1, > derivative=0, method=None, kwargs={} / f_lineno: 528 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(3+4j), a=1, > derivative=0, method=None, kwargs={} / f_lineno: 530 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(3+4j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 531 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(3+4j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 532 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(3+4j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 533 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ call(zeta_) / f_code.co_name: f / f_locals: x=(3+4j), > kwargs={}, name='zeta' / f_lineno: 989 / f_code.co_filename: > /mpmath/ctx_mp_python.py / f_back.f_lineno: 533 / f_back.f_code.co_filename: > /mpmath/functions/zeta.py / arg: None > │ line(zeta_) / f_code.co_name: f / f_locals: > x=...045117397880679064, k=2 / f_lineno: 2045 / f_code.co_filename: > /mpmath/libmp/gammazeta.py / f_back.f_lineno: 1007 / f_back.f_code.co_filename: > /mpmath/ctx_mp_python.py / arg: None > │ line(gamma_) / f_code.co_name: mpc_gamma / f_locals: z=((0, > 1, -1, 1), (0, 3978571390186527, -48, 52)), prec=53, rnd='n', type=0, a=(0, 1, > -1, 1), b=(0, 3978571390186527, -48, 52), asign=0, aman=1, aexp=-1, abc=1, > bsign=0, bman=3978571390186527, bexp=-48, bbc=52, wp=79, amag=0, bmag=4, mag=4, > an=0, bn=14, absn=14j, gamma_size=56, need_reflection=0, zorig=((0, 1, -1, 1), > (0, 3978571390186527, -48, 52)), yfinal=0, balance_prec=0, n_for_stirling=15, > need_reduction=True, afix=2115620184325601055735808, > bfix=8543917002826194402410496, r=0, zprered=((0, 1, -1, 1), (0, > 3978571390186527, -48, 52)), d=5, rre=-542313259704087430481959845, > one=604462909807314587353088, rim=-1657865507045117397880679064, k=2 / f_lineno: > 2043 / f_code.co_filename: /mpmath/libmp/gammazeta.py / f_back.f_lineno: 1007 / > f_back.f_code.co_filename: /mpmath/ctx_mp_python.py / arg: None > │ gamma_ / result: (-1.4455538437607e-10 - > 5.52278876877407e-10j) / count: 318 > │ gamma__ / s: Complex { re: 0.5, im: 14.134725 } / result: > Ok(Complex { re: -1.4455538437606964e-10, im: -5.522788768774066e-10 }) > │ zeta__ / s: Complex { re: 0.5, im: -14.134725 } / result: > Ok(Complex { re: 1.7674298413849186e-8, im: 1.1102028930923156e-7 }) / z: > Complex { re: 0.0, im: 0.0 } > │ { name = __assert_lt; expected = +0.000100 } > │ { name = __assert_lt; expected = +0.000100 } > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## test_euler_product_formula > > ── spiral ────────────────────────────────────────────────────────────────────── > inl test_euler_product_formula log = run_test log fun zeta, gamma => > inl s_values = join [[ 2; 2.5; 3; 3.5; 4; 4.5; 5 ]] > inl primes = join [[ 2; 3; 5; 7; 11; 13; 17; 19; 23; 29; 31; 37; 41; 43; 47; > 53; 59; 61; 67; 71 ]] > s_values > |> listm.iter fun s_re => > inl s = .^(s_re, 0) > inl product = > (1, primes) > ||> listm.fold fun acc x => > acc * 1 / (1 - x ** -s_re) > > inl result = zeta s > re result - product |> abs |> _assert_lt 0.01 > result |> im |> _assert_lt 0.01 > > ── spiral ────────────────────────────────────────────────────────────────────── > //// test > ///! rust -d num-complex pyo3='=0.26.0' > > test_euler_product_formula true > > ── [ 7.42s - return value ] ──────────────────────────────────────────────────── > │ zeta_ / s: (2.0, 0.0) / count: 0 > │ call(zeta_) / f_code.co_name: zeta / f_locals: s=(2+0j), a=1, > derivative=0, method=None, kwargs={} / f_lineno: 528 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2+0j), a=1, > derivative=0, method=None, kwargs={} / f_lineno: 530 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2+0j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 531 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2+0j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 532 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ line(zeta_) / f_code.co_name: zeta / f_locals: s=(2+0j), a=1, > derivative=0, method=None, kwargs={}, d=0 / f_lineno: 533 / f_code.co_filename: > /mpmath/functions/zeta.py / f_back.f_lineno: 25 / f_back.f_code.co_filename: > <string> / arg: None > │ call(zeta_) / f_code.co_name: f / f_locals: x=(2+0j), > kwargs={}, name='zeta' / f_lineno: 989 / f_code.co_filename: > /mpmath/ctx_mp_python.py / f_back.f_lineno: 533 / f_back.f_code.co_filename: > /mpmath/functions/zeta.py / arg: None > │ line(zeta_) / f_code.co_name: f / f_locals: x=...eta.py / > f_back.f_lineno: 985 / f_back.f_code.co_filename: /mpmath/libmp/gammazeta.py / > arg: None > │ line(zeta_) / f_code.co_name: mpf_zeta_int / f_locals: s=5, > prec=53, rnd='n', wp=73, m=19.25, needed_terms=623488, n=33, d=[1, 2179, 792067, > 115062531, 8930212611, 429314925315, 13983537177347, 327666966438659, > 5764846406968067, 78615943485956867, 851604426176701187, 7470527451121689347, > 53898915046387983107, 323897845985013506819, 1638178356374090130179, > 7034281785235908174595, 25833609859980306522883, 81661917475887913739011, > 223448095548034217779971, 532029677981012660429571, 1108048631855905753375491, > 2029946562680066824315651, 3292927237466655352791811, 4769455369342763680768771, > 6235511670496346417767171, 7463408621503347142796035, 8322751284048216428487427, > 8818779962777819524211459, 9050689474911140452082435, 9136270117622166323831555, > 9160252037839493347779331, 9165045885455648617505539, 9165654628010081032708867, > 9165691521498228451812099], t=-84153986440240940095109733900764881301998910956, > k=26 / f_lineno: 954 / f_code.co_filename: /mpmath/libmp/gammazeta.py / > f_back.f_lineno: 985 / f_back.f_code.co_filename: /mpmath/libmp/gammazeta.py / > arg: None > │ zeta_ / result: (1.03692775514337 + 0.0j) / count: 228 > │ zeta / count: 0 / s: Complex { re: 5.0, im: 0.0 } > │ zeta__ / s: Complex { re: 5.0, im: 0.0 } / result: Ok(Complex > { re: 1.03692775514337, im: 0.0 }) / z: Complex { re: NaN, im: NaN } > │ { name = __assert_lt; expected = +0.010000 } > │ { name = __assert_lt; expected = +0.010000 } > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## graph > > ── mermaid ───────────────────────────────────────────────────────────────────── > │ <div class="mermaidMarkdownContainer" > style="background-color:white"> > │ <link rel="stylesheet" > href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css" > > > │ <div > id="5bafbdcd0a37d73c9537431f21df3739beb7a90411d9002454eb71c9d9f37e56"></div> > │ <script type="module"> > │ > │ import mermaid from > 'https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.esm.min.mjs'; > │ let renderTarget = > document.getElementById('5bafbdcd0a37d73c9537431f21df3739beb7a90411d9002454eb71c > 9d9f37e56'); > │ try { > │ const {svg, bindFunctions} = await > mermaid.mermaidAPI.render( > │ > 'mermaid_5bafbdcd0a37d73c9537431f21df3739beb7a90411d9002454eb71c9d9f37e56', > │ `graph TD > │ zeta("zeta()") --> convert > │ zeta --> f["f()"] > │ f --> mpc_f["mpc_zeta()"] > │ f --> mpf_f["mpf_zeta()"] > │ convert --> from_float > │ from_float --> from_man_exp > │ from_man_exp --> python_bitcount > │ python_bitcount --> _normalize > │ _normalize --> make_mpc > │ make_mpc --> mpc_zeta["mpc_zeta()"] > │ mpc_zeta --> mpf_zeta["mpf_zeta()"] > │ mpf_zeta --> to_int > │ to_int --> mpf_zeta_int["mpf_zeta_int()"] > │ mpf_zeta_int --> borwein_coefficients > │ borwein_coefficients --> > from_man_exp_2("from_man_exp()") > │ from_man_exp_2 --> > python_bitcount_2("python_bitcount()") > │ python_bitcount_2 --> _normalize_2("_normalize()") > │ _normalize_2 --> make_mpc_2("make_mpc()") > │ make_mpc_2 --> stop_trace > │ mpf_zeta_int --> mpf_bernoulli > │ mpf_bernoulli --> bernoulli_size > │ bernoulli_size --> mpf_rdiv_int > │ mpf_rdiv_int --> python_bitcount_3("python_bitcount()") > │ python_bitcount_3 --> _normalize1 > │ _normalize1 --> from_man_exp_3("from_man_exp()") > │ from_man_exp_3 --> _normalize_3("_normalize()") > │ _normalize_3 --> mpf_sub > │ mpf_sub --> mpf_add > │ mpf_add --> mpf_neg > │ mpf_neg --> _normalize1_2("_normalize1()") > │ _normalize1_2 --> from_int > │ from_int --> mpf_div > │ mpf_div --> python_bitcount_4("python_bitcount()") > │ python_bitcount_4 --> _normalize1_3("_normalize1()") > │ _normalize1_3 --> make_mpc_3("make_mpc()") > │ make_mpc_3 --> final_stop["stop_trace()"]`); > │ renderTarget.innerHTML = svg; > │ bindFunctions?.(renderTarget); > │ } > │ catch (error) { > │ console.log(error); > │ } > │ </script> > │ </div> > │ > > ── mermaid ───────────────────────────────────────────────────────────────────── > │ <div class="mermaidMarkdownContainer" > style="background-color:white"> > │ <link rel="stylesheet" > href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css" > > > │ <div > id="aaf0666a42db8a3ac57b6ca8f8968b39ef22fac6162cb4bcaf08a38290a0f7b4"></div> > │ <script type="module"> > │ > │ import mermaid from > 'https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.esm.min.mjs'; > │ let renderTarget = > document.getElementById('aaf0666a42db8a3ac57b6ca8f8968b39ef22fac6162cb4bcaf08a38 > 290a0f7b4'); > │ try { > │ const {svg, bindFunctions} = await > mermaid.mermaidAPI.render( > │ > 'mermaid_aaf0666a42db8a3ac57b6ca8f8968b39ef22fac6162cb4bcaf08a38290a0f7b4', > │ `graph TD > │ zeta_rust("zeta() - Rust") --> num_traits("num-traits") > │ zeta_rust --> num_bigint("num-bigint") > │ zeta_rust --> rust_decimal("rust_decimal for > precision") > │ zeta_rust --> error_handling("Rust Error Handling") > │ > │ num_traits --> num_traits_usage("Use for common > traits") > │ num_bigint --> bigint_operations("Arbitrary-precision > arithmetic operations") > │ rust_decimal --> decimal_operations("High-precision > decimal operations") > │ error_handling --> result_type("Use Result<T, E> for > error handling") > │ > │ bigint_operations --> convert_rust("convert() - Rust") > │ bigint_operations --> normalize_rust("_normalize() - > Rust") > │ > │ convert_rust --> from_float_rust("from_float() - Rust") > │ from_float_rust --> from_man_exp_rust("from_man_exp() - > Rust") > │ from_man_exp_rust --> bitcount_rust("bitcount() - > Rust") > │ bitcount_rust --> normalize_rust > │ normalize_rust --> mpc_zeta_rust("mpc_zeta() - Rust") > │ mpc_zeta_rust --> mpf_zeta_rust("mpf_zeta() - Rust") > │ mpf_zeta_rust --> to_int_rust("to_int() - Rust") > │ to_int_rust --> mpf_zeta_int_rust("mpf_zeta_int() - > Rust") > │ > │ mpf_zeta_int_rust --> > borwein_coefficients_rust("borwein_coefficients() - Rust") > │ borwein_coefficients_rust --> > from_man_exp_rust_2("from_man_exp() - Rust") > │ from_man_exp_rust_2 --> bitcount_rust_2("bitcount() - > Rust") > │ bitcount_rust_2 --> normalize_rust_2("_normalize() - > Rust") > │ normalize_rust_2 --> make_mpc_rust("make_mpc() - Rust") > │ > │ mpf_zeta_int_rust --> > mpf_bernoulli_rust("mpf_bernoulli() - Rust") > │ mpf_bernoulli_rust --> > bernoulli_size_rust("bernoulli_size() - Rust") > │ bernoulli_size_rust --> > mpf_rdiv_int_rust("mpf_rdiv_int() - Rust") > │ mpf_rdiv_int_rust --> bitcount_rust_3("bitcount() - > Rust") > │ bitcount_rust_3 --> normalize1_rust("_normalize1() - > Rust") > │ normalize1_rust --> from_man_exp_rust_3("from_man_exp() > - Rust") > │ from_man_exp_rust_3 --> normalize_rust_3("_normalize() > - Rust") > │ normalize_rust_3 --> mpf_sub_rust("mpf_sub() - Rust") > │ mpf_sub_rust --> mpf_add_rust("mpf_add() - Rust") > │ mpf_add_rust --> mpf_neg_rust("mpf_neg() - Rust") > │ mpf_neg_rust --> normalize1_rust_2("_normalize1() - > Rust") > │ normalize1_rust_2 --> from_int_rust("from_int() - > Rust") > │ from_int_rust --> mpf_div_rust("mpf_div() - Rust") > │ mpf_div_rust --> bitcount_rust_4("bitcount() - Rust") > │ bitcount_rust_4 --> normalize1_rust_3("_normalize1() - > Rust") > │ > │ style zeta_rust fill:#f9f,stroke:#333,stroke-width:4px > │ style num_traits fill:#bbf,stroke:#333,stroke-width:2px > │ style num_bigint fill:#bbf,stroke:#333,stroke-width:2px > │ style rust_decimal > fill:#bbf,stroke:#333,stroke-width:2px > │ style error_handling > fill:#bbf,stroke:#333,stroke-width:2px > │ style bigint_operations > fill:#bfb,stroke:#333,stroke-width:2px > │ style decimal_operations > fill:#bfb,stroke:#333,stroke-width:2px > │ style result_type > fill:#bfb,stroke:#333,stroke-width:2px`); > │ renderTarget.innerHTML = svg; > │ bindFunctions?.(renderTarget); > │ } > │ catch (error) { > │ console.log(error); > │ } > │ </script> > │ </div> > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## tests > > ── spiral ────────────────────────────────────────────────────────────────────── > inl tests () = > testing.run_tests_log { > test_zeta_at_known_values_ > test_zeta_at_2_minus2 > test_trivial_zero_at_negative_even___ > test_non_trivial_zero___ > test_real_part_greater_than_one___ > test_zeta_at_1___ > test_symmetry_across_real_axis___ > test_behavior_near_origin___ > test_imaginary_axis > test_critical_strip > test_reflection_formula_for_specific_value > test_euler_product_formula > } > > ── spiral ────────────────────────────────────────────────────────────────────── > ///! _ > > inl main (_args : array_base string) = > inl value = 1i32 > console.write_line ($'$"value: {!value}"' : string) > 0i32 > > inl main () = > $'let tests () = !tests ()' : () > $'let main args = !main args' : () 00:02:05 v #3 runtime.execute_with_options / result / { file_name = dotnet; exit_code = 0; std_trace_length = 79059 } 00:02:05 d #4 runtime.execute_with_options / { file_name = jupyter; arguments = ["nbconvert", "/home/runner/work/polyglot/polyglot/lib/math/math.dib.ipynb", "--to", "html", "--HTMLExporter.theme=dark"]; options = { command = jupyter nbconvert "/home/runner/work/polyglot/polyglot/lib/math/math.dib.ipynb" --to html --HTMLExporter.theme=dark; cancellation_token = None; environment_variables = Array(MutCell([])); on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:02:06 v #5 ! [NbConvertApp] Converting notebook /home/runner/work/polyglot/polyglot/lib/math/math.dib.ipynb to html 00:02:06 v #6 ! /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/nbformat/__init__.py:96: MissingIDFieldWarning: Cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future. 00:02:06 v #7 ! validate(nb) 00:02:06 v #8 ! /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/nbconvert/filters/highlight.py:71: UserWarning: IPython3 lexer unavailable, falling back on Python 3 00:02:06 v #9 ! return _pygments_highlight( 00:02:07 v #10 ! [NbConvertApp] Writing 7185375 bytes to /home/runner/work/polyglot/polyglot/lib/math/math.dib.html 00:02:07 v #11 runtime.execute_with_options / result / { file_name = jupyter; exit_code = 0; std_trace_length = 891 } 00:02:07 d #12 spiral.process_dib / dib / jupyter nbconvert / { exit_code = 0; jupyter_result_length = 891 } 00:02:07 d #13 runtime.execute_with_options / { file_name = pwsh; arguments = ["-c", "$counter = 1; $path = '/home/runner/work/polyglot/polyglot/lib/math/math.dib.html'; (Get-Content $path -Raw) -replace '(id=\\\"cell-id=)[a-fA-F0-9]{8}', { $_.Groups[1].Value + $counter++ } | Set-Content $path"]; options = { command = pwsh -c "$counter = 1; $path = '/home/runner/work/polyglot/polyglot/lib/math/math.dib.html'; (Get-Content $path -Raw) -replace '(id=\"cell-id=)[a-fA-F0-9]{8}', { $_.Groups[1].Value + $counter++ } | Set-Content $path"; cancellation_token = None; environment_variables = Array(MutCell([])); on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:02:08 v #14 runtime.execute_with_options / result / { file_name = pwsh; exit_code = 0; std_trace_length = 0 } 00:02:08 d #15 spiral.run / dib / html cell ids / { exit_code = 0; pwsh_replace_html_result_length = 0 } 00:02:08 d #16 spiral.process_dib / dib / { exit_code = 0; result_length = 80009 } 00:00:00 d #1 writeDibCode / output: Spi / path: math.dib 00:00:00 d #2 parseDibCode / output: Spi / file: math.dib 00:00:00 d #1 persistCodeProject / packages: [Fable.Core] / modules: [deps/spiral/lib/spiral/common.fsx; deps/spiral/lib/spiral/sm.fsx; deps/spiral/lib/spiral/crypto.fsx; ... ] / name: math / hash: / code.Length: 219497 00:00:00 d #2 buildProject / fullPath: /home/runner/work/polyglot/polyglot/target/Builder/math/math.fsproj 00:00:00 d #1 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 "publish "/home/runner/work/polyglot/polyglot/target/Builder/math/math.fsproj" --configuration Release --output "/home/runner/work/polyglot/polyglot/lib/math/dist" --runtime linux-x64"; options = { command = dotnet publish "/home/runner/work/polyglot/polyglot/target/Builder/math/math.fsproj" --configuration Release --output "/home/runner/work/polyglot/polyglot/lib/math/dist" --runtime linux-x64; cancellation_token = None; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot/target/Builder/math"; stderr = true } } 00:00:00 v #2 > Determining projects to restore... 00:00:01 v #3 > Paket version 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 00:00:01 v #4 > The last full restore is still up to date. Nothing left to do. 00:00:01 v #5 > Total time taken: 0 milliseconds 00:00:01 v #6 > Paket version 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 00:00:01 v #7 > Restoring /home/runner/work/polyglot/polyglot/target/Builder/math/math.fsproj 00:00:01 v #8 > Starting restore process. 00:00:01 v #9 > Total time taken: 0 milliseconds 00:00:02 v #10 > Restored /home/runner/work/polyglot/polyglot/target/Builder/math/math.fsproj (in 273 ms). 00:00:14 v #11 > math -> /home/runner/work/polyglot/polyglot/target/Builder/math/bin/Release/net9.0/linux-x64/math.dll 00:00:14 v #12 > math -> /home/runner/work/polyglot/polyglot/lib/math/dist 00:00:14 d #13 runtime.execute_with_options_async / { exit_code = 0; output_length = 662; options = { command = dotnet publish "/home/runner/work/polyglot/polyglot/target/Builder/math/math.fsproj" --configuration Release --output "/home/runner/work/polyglot/polyglot/lib/math/dist" --runtime linux-x64; cancellation_token = None; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot/target/Builder/math"; stderr = true } } spiral/lib/spiral/lib.ps1/GetTargetDir / targetDir: /home/runner/work/polyglot/polyglot/target/Builder/math polyglot/scripts/core.ps1/ResolveLink #4 / Path: /home/runner/work/polyglot/polyglot/deps/spiral/lib/spiral/../../deps/polyglot / parent_target: / path_target: /home/runner/work/polyglot/polyglot / parent: /home/runner/work/polyglot/polyglot/deps/spiral/lib/spiral/../../deps / End: polyglot spiral/lib/spiral/lib.ps1/BuildFable / TargetDir: /home/runner/work/polyglot/polyglot/target/Builder/math / ProjectName: math / Language: rs / Runtime: / root: /home/runner/work/polyglot/polyglot Fable 5.0.0-alpha.9: F# to Rust compiler (status: alpha) Thanks to the contributor! @sasmithjr Stand with Ukraine! https://standwithukraine.com.ua/ Parsing target/Builder/math/math.fsproj... Project and references (14 source files) parsed in 3121ms Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.JSInterop.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Routing.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Routing.Abstractions.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Mvc.ViewFeatures.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Mvc.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Mvc.Core.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Http.Abstractions.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Components.Forms.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Components.Endpoints.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Could not scan /usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.9/ref/net9.0/Microsoft.AspNetCore.Components.dll for Fable plugins, skipping this assembly. Original error: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'MetadataUpdateHandlerAttribute' is required here and is unavailable. You must add a reference to assembly 'System.Runtime.Loader, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.) Started Fable compilation... Fable compilation finished in 10003ms ./deps/spiral/lib/spiral/sm.fsx(561,0): (561,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/common.fsx(2339,0): (2339,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/async_.fsx(252,0): (252,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/threading.fsx(139,0): (139,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/crypto.fsx(2569,0): (2569,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/date_time.fsx(2553,0): (2553,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/platform.fsx(122,0): (122,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/networking.fsx(5637,0): (5637,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/trace.fsx(2897,0): (2897,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/runtime.fsx(9581,0): (9581,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./deps/spiral/lib/spiral/file_system.fsx(21240,0): (21240,2) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! ./target/Builder/math/math.fs(35,0): (37,3) warning FABLE: For Rust, support for F# static and module do bindings is disabled by default. It can be enabled with the 'static_do_bindings' feature. Use at your own risk! warning: /home/runner/work/polyglot/spiral/apps/wasm/Cargo.toml: the cargo feature `edition2024` has been stabilized in the 1.85 release and is no longer necessary to be listed in the manifest See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature. warning: /home/runner/work/polyglot/spiral/apps/spiral/Cargo.toml: the cargo feature `edition2024` has been stabilized in the 1.85 release and is no longer necessary to be listed in the manifest See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature. Checking fable_library_rust v0.1.0 (/home/runner/work/polyglot/spiral/deps/polyglot/lib/rust/fable/fable_modules/fable-library-rust) Checking spiral_lib v0.0.1 (/home/runner/work/polyglot/spiral/lib/spiral) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./trace.rs (18 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./common.rs (18 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./crypto.rs (17 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs (229 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./file_system.rs (180 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./sm.rs (11 fixes) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./networking.rs (54 fixes) warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1382:17 | 1382 | / break '_method34 1383 | | { 1384 | | let v176: Runtime::US8 = 1385 | | if string("") == (v1.get().clone()) { ... | 1467 | | } ; | |______________________^ | = note: `#[warn(break_with_label_and_loop)]` on by default help: wrap this expression in parentheses | 1383 ~ ({ 1384 | let v176: Runtime::US8 = ... 1466 | } 1467 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1646:17 | 1646 | / break '_method38 1647 | | { 1648 | | let v200: Runtime::US8 = 1649 | | if string("") == (v1.get().clone()) { ... | 1733 | | } ; | |______________________^ | help: wrap this expression in parentheses | 1647 ~ ({ 1648 | let v200: Runtime::US8 = ... 1732 | } 1733 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1801:17 | 1801 | / break '_method42 1802 | | { 1803 | | let v66: Runtime::US8 = 1804 | | if string("") == (v1.get().clone()) { ... | 1855 | | } ; | |______________________^ | help: wrap this expression in parentheses | 1802 ~ ({ 1803 | let v66: Runtime::US8 = ... 1854 | } 1855 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3277:17 | 3277 | / break '_method69 3278 | | { 3279 | | let v224: Runtime::US8 = 3280 | | if string("") == (v1.get().clone()) { ... | 3349 | | } ; | |______________________^ | help: wrap this expression in parentheses | 3278 ~ ({ 3279 | let v224: Runtime::US8 = ... 3348 | } 3349 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3685:17 | 3685 | / break '_method70 3686 | | { 3687 | | let v200: Runtime::US8 = 3688 | | if string("") == (v1.get().clone()) { ... | 3800 | | } ; | |______________________^ | help: wrap this expression in parentheses | 3686 ~ ({ 3687 | let v200: Runtime::US8 = ... 3799 | } 3800 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3828:17 | 3828 | / break '_method75 3829 | | { 3830 | | let v200: Runtime::US8 = 3831 | | if string("") == (v1.get().clone()) { ... | 3914 | | } ; | |______________________^ | help: wrap this expression in parentheses | 3829 ~ ({ 3830 | let v200: Runtime::US8 = ... 3913 | } 3914 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3927:17 | 3927 | / break '_method67 3928 | | { 3929 | | let v5: bool = string("") == (v1.get().clone()); 3930 | | let v224: Runtime::US8 = ... | 4427 | | } ; | |______________________^ | help: wrap this expression in parentheses | 3928 ~ ({ 3929 | let v5: bool = string("") == (v1.get().clone()); ... 4426 | } 4427 ~ }) ; | System.Management.Automation.RemoteException warning: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> /home/runner/work/polyglot/spiral/lib/spiral/./common.rs:720:17 | 720 | / break '_method8 721 | | { 722 | | let result: LrcPtr<MutCell<Common::US7>> = 723 | | refCell(Common::US7::US7_1); ... | 753 | | } ; | |______________________^ | help: wrap this expression in parentheses | 721 ~ ({ 722 | let result: LrcPtr<MutCell<Common::US7>> = ... 752 | } 753 ~ }) ; | System.Management.Automation.RemoteException warning: `spiral_lib` (lib test) generated 8 warnings (run `cargo fix --lib -p spiral_lib --tests` to apply 8 suggestions) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./common.rs (1 fix) Fixed /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs (7 fixes) warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1383:21 | 1383 | ({ | ^ ... 1467 | }) ; | ^ | = note: `#[warn(unused_parens)]` on by default help: remove these parentheses | 1383 ~ { 1384 | let v176: Runtime::US8 = ... 1466 | } 1467 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1647:21 | 1647 | ({ | ^ ... 1733 | }) ; | ^ | help: remove these parentheses | 1647 ~ { 1648 | let v200: Runtime::US8 = ... 1732 | } 1733 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:1802:21 | 1802 | ({ | ^ ... 1855 | }) ; | ^ | help: remove these parentheses | 1802 ~ { 1803 | let v66: Runtime::US8 = ... 1854 | } 1855 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3278:21 | 3278 | ({ | ^ ... 3349 | }) ; | ^ | help: remove these parentheses | 3278 ~ { 3279 | let v224: Runtime::US8 = ... 3348 | } 3349 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3686:21 | 3686 | ({ | ^ ... 3800 | }) ; | ^ | help: remove these parentheses | 3686 ~ { 3687 | let v200: Runtime::US8 = ... 3799 | } 3800 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3829:21 | 3829 | ({ | ^ ... 3914 | }) ; | ^ | help: remove these parentheses | 3829 ~ { 3830 | let v200: Runtime::US8 = ... 3913 | } 3914 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./runtime.rs:3928:21 | 3928 | ({ | ^ ... 4427 | }) ; | ^ | help: remove these parentheses | 3928 ~ { 3929 | let v5: bool = string("") == (v1.get().clone()); ... 4426 | } 4427 ~ } ; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/spiral/lib/spiral/./common.rs:721:21 | 721 | ({ | ^ ... 753 | }) ; | ^ | help: remove these parentheses | 721 ~ { 722 | let result: LrcPtr<MutCell<Common::US7>> = ... 752 | } 753 ~ } ; | System.Management.Automation.RemoteException warning: `spiral_lib` (lib) generated 8 warnings (run `cargo fix --lib -p spiral_lib` to apply 8 suggestions) Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.41s polyglot/lib/math/build.ps1 / path: /home/runner/work/polyglot/polyglot/target/Builder/math/target/rs/math.rs warning: /home/runner/work/polyglot/polyglot/apps/plot/Cargo.toml: the cargo feature `edition2024` has been stabilized in the 1.85 release and is no longer necessary to be listed in the manifest See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature. warning: /home/runner/work/polyglot/polyglot/lib/math/Cargo.toml: the cargo feature `edition2024` has been stabilized in the 1.85 release and is no longer necessary to be listed in the manifest See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature. Updating crates.io index Downloading crates ... Downloaded approx v0.5.1 Downloaded digest v0.11.0-pre.9 Downloaded hybrid-array v0.2.3 Downloaded crypto-common v0.2.0-rc.1 Downloaded rawpointer v0.2.1 Downloaded float-cmp v0.10.0 Downloaded sha2 v0.11.0-pre.4 Downloaded const-oid v0.10.0-rc.0 Downloaded rand_distr v0.4.3 Downloaded simba v0.9.1 Downloaded safe_arch v0.7.4 Downloaded wide v0.7.33 Downloaded libm v0.2.15 Downloaded statrs v0.18.0 Downloaded matrixmultiply v0.3.10 Downloaded nalgebra v0.33.2 Downloaded block-buffer v0.11.0-rc.1 Compiling autocfg v1.5.0 Compiling libc v0.2.177 Compiling target-lexicon v0.13.3 Compiling libm v0.2.15 Compiling num-traits v0.2.19 Compiling cfg-if v1.0.4 Compiling typenum v1.19.0 Compiling pyo3-build-config v0.26.0 Compiling zerocopy v0.8.27 Compiling proc-macro2 v1.0.103 Compiling memchr v2.7.6 Compiling getrandom v0.2.16 Compiling quote v1.0.41 Compiling unicode-ident v1.0.20 Compiling rand_core v0.6.4 Compiling bytemuck v1.24.0 Compiling futures-sink v0.3.31 Compiling futures-core v0.3.31 Compiling paste v1.0.15 Compiling futures-channel v0.3.31 Compiling safe_arch v0.7.4 Compiling pyo3-ffi v0.26.0 Compiling pyo3-macros-backend v0.26.0 Compiling hybrid-array v0.2.3 Compiling matrixmultiply v0.3.10 Compiling futures-task v0.3.31 Compiling pin-utils v0.1.0 Compiling getrandom v0.3.4 Compiling pin-project-lite v0.2.16 Compiling slab v0.4.11 Compiling futures-io v0.3.31 Compiling wide v0.7.33 Compiling futures-util v0.3.31 Compiling crypto-common v0.2.0-rc.1 Compiling ppv-lite86 v0.2.21 Compiling rand_chacha v0.3.1 Compiling rand v0.8.5 Compiling syn v2.0.108 Compiling approx v0.5.1 Compiling num-complex v0.4.6 Compiling num-integer v0.1.46 Compiling num_cpus v1.17.0 Compiling memoffset v0.9.1 Compiling rawpointer v0.2.1 Compiling heck v0.5.0 Compiling futures-executor v0.3.31 Compiling num-rational v0.4.2 Compiling simba v0.9.1 Compiling rand_distr v0.4.3 Compiling block-buffer v0.11.0-rc.1 Compiling aho-corasick v1.1.3 Compiling pyo3 v0.26.0 Compiling regex-syntax v0.8.8 Compiling iana-time-zone v0.1.64 Compiling const-oid v0.10.0-rc.0 Compiling digest v0.11.0-pre.9 Compiling chrono v0.4.42 Compiling regex-automata v0.4.13 Compiling nalgebra v0.33.2 Compiling uuid v1.18.1 Compiling futures v0.3.31 Compiling futures-timer v3.0.3 Compiling cpufeatures v0.2.17 Compiling startup v0.1.1 (/home/runner/work/polyglot/polyglot/lib/rust/fable/fable_modules/fable-library-rust/vendored/startup) Compiling once_cell v1.21.3 Compiling unindent v0.2.4 Compiling indoc v2.0.7 Compiling fable_library_rust v0.1.0 (/home/runner/work/polyglot/polyglot/lib/rust/fable/fable_modules/fable-library-rust) Compiling pyo3-macros v0.26.0 Compiling sha2 v0.11.0-pre.4 Compiling regex v1.12.2 Compiling float-cmp v0.10.0 Compiling inline_colorization v0.1.6 Compiling statrs v0.18.0 Compiling math v0.0.1 (/home/runner/work/polyglot/polyglot/lib/math) Finished `release` profile [optimized] target(s) in 27.68s Running unittests math.rs (/home/runner/work/polyglot/polyglot/workspace/target/release/deps/math-7de9371e8032fa88) running 12 tests test module_b7a9935b::Math::test_behavior_near_origin___ ... ok test module_b7a9935b::Math::test_critical_strip ... ok test module_b7a9935b::Math::test_euler_product_formula ... ok test module_b7a9935b::Math::test_real_part_greater_than_one___ ... ok test module_b7a9935b::Math::test_non_trivial_zero___ ... ok test module_b7a9935b::Math::test_symmetry_across_real_axis___ ... ok test module_b7a9935b::Math::test_zeta_at_1___ ... ok test module_b7a9935b::Math::test_zeta_at_2_minus2 ... ok test module_b7a9935b::Math::test_zeta_at_known_values_ ... ok test module_b7a9935b::Math::test_reflection_formula_for_specific_value ... ok test module_b7a9935b::Math::test_trivial_zero_at_negative_even___ ... ok test module_b7a9935b::Math::test_imaginary_axis ... ok test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.20s polyglot/lib/math/build.ps1 / $targetDir: /home/runner/work/polyglot/polyglot/target/Builder/math / $projectName: math / $env:CI:'true'
In [ ]:
{ pwsh ../apps/plot/build.ps1 } | Invoke-Block
warning: /home/runner/work/polyglot/polyglot/apps/plot/Cargo.toml: the cargo feature `edition2024` has been stabilized in the 1.85 release and is no longer necessary to be listed in the manifest See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature. warning: /home/runner/work/polyglot/polyglot/lib/math/Cargo.toml: the cargo feature `edition2024` has been stabilized in the 1.85 release and is no longer necessary to be listed in the manifest See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature. Downloading crates ... Downloaded plotters-svg v0.3.7 Downloaded plotters-backend v0.3.7 Downloaded plotters v0.3.7 Downloaded serde_json v1.0.143 Compiling memchr v2.7.6 Compiling num-traits v0.2.19 Compiling libc v0.2.177 Compiling typenum v1.19.0 Compiling futures-sink v0.3.31 Compiling futures-core v0.3.31 Compiling futures-channel v0.3.31 Compiling slab v0.4.11 Compiling serde_core v1.0.228 Compiling pin-project-lite v0.2.16 Compiling cfg-if v1.0.4 Compiling futures-io v0.3.31 Compiling hybrid-array v0.2.3 Compiling pin-utils v0.1.0 Compiling futures-task v0.3.31 Compiling futures-util v0.3.31 Compiling num_cpus v1.17.0 Compiling crypto-common v0.2.0-rc.1 Compiling serde v1.0.228 Compiling getrandom v0.3.4 Compiling aho-corasick v1.1.3 Compiling block-buffer v0.11.0-rc.1 Compiling iana-time-zone v0.1.64 Compiling regex-syntax v0.8.8 Compiling futures-executor v0.3.31 Compiling serde_json v1.0.143 Compiling const-oid v0.10.0-rc.0 Compiling plotters-backend v0.3.7 Compiling digest v0.11.0-pre.9 Compiling plotters-svg v0.3.7 Compiling futures v0.3.31 Compiling chrono v0.4.42 Compiling uuid v1.18.1 Compiling itoa v1.0.15 Compiling futures-timer v3.0.3 Compiling startup v0.1.1 (/home/runner/work/polyglot/polyglot/lib/rust/fable/fable_modules/fable-library-rust/vendored/startup) Compiling cpufeatures v0.2.17 Compiling ryu v1.0.20 Compiling regex-automata v0.4.13 Compiling fable_library_rust v0.1.0 (/home/runner/work/polyglot/polyglot/lib/rust/fable/fable_modules/fable-library-rust) Compiling sha2 v0.11.0-pre.4 Compiling plotters v0.3.7 Compiling inline_colorization v0.1.6 Compiling regex v1.12.2 Compiling plot v0.0.1 (/home/runner/work/polyglot/polyglot/apps/plot) warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/polyglot/apps/plot/../../deps/spiral/lib/spiral/./runtime.rs:1782:30 | 1782 | break '_method34 ({ | ^ ... 1863 | }); | ^ | = note: `#[warn(unused_parens)]` on by default help: remove these parentheses | 1782 ~ break '_method34 { 1783 | let v176: Runtime::US8 = if string("") == (v1.get().clone()) { ... 1862 | } 1863 ~ }; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/polyglot/apps/plot/../../deps/spiral/lib/spiral/./runtime.rs:2100:30 | 2100 | break '_method38 ({ | ^ ... 2181 | }); | ^ | help: remove these parentheses | 2100 ~ break '_method38 { 2101 | let v200: Runtime::US8 = if string("") == (v1.get().clone()) { ... 2180 | } 2181 ~ }; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/polyglot/apps/plot/../../deps/spiral/lib/spiral/./runtime.rs:2269:30 | 2269 | break '_method42 ({ | ^ ... 2319 | }); | ^ | help: remove these parentheses | 2269 ~ break '_method42 { 2270 | let v66: Runtime::US8 = if string("") == (v1.get().clone()) { ... 2318 | } 2319 ~ }; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/polyglot/apps/plot/../../deps/spiral/lib/spiral/./runtime.rs:4184:30 | 4184 | break '_method69 ({ | ^ ... 4254 | }); | ^ | help: remove these parentheses | 4184 ~ break '_method69 { 4185 | let v224: Runtime::US8 = if string("") == (v1.get().clone()) { ... 4253 | } 4254 ~ }; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/polyglot/apps/plot/../../deps/spiral/lib/spiral/./runtime.rs:4621:30 | 4621 | break '_method70 ({ | ^ ... 4733 | }); | ^ | help: remove these parentheses | 4621 ~ break '_method70 { 4622 | let v200: Runtime::US8 = if string("") == (v1.get().clone()) { ... 4732 | } 4733 ~ }; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/polyglot/apps/plot/../../deps/spiral/lib/spiral/./runtime.rs:4769:30 | 4769 | break '_method75 ({ | ^ ... 4850 | }); | ^ | help: remove these parentheses | 4769 ~ break '_method75 { 4770 | let v200: Runtime::US8 = if string("") == (v1.get().clone()) { ... 4849 | } 4850 ~ }; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/polyglot/apps/plot/../../deps/spiral/lib/spiral/./runtime.rs:4866:30 | 4866 | break '_method67 ({ | ^ ... 5381 | }); | ^ | help: remove these parentheses | 4866 ~ break '_method67 { 4867 | let v5: bool = string("") == (v1.get().clone()); ... 5380 | } 5381 ~ }; | System.Management.Automation.RemoteException warning: unnecessary parentheses around `break` value --> /home/runner/work/polyglot/polyglot/apps/plot/../../deps/spiral/lib/spiral/./common.rs:901:29 | 901 | break '_method8 ({ | ^ ... 938 | }); | ^ | help: remove these parentheses | 901 ~ break '_method8 { 902 | let result: LrcPtr<MutCell<Common::US7>> = refCell(Common::US7::US7_1); ... 937 | } 938 ~ }; | System.Management.Automation.RemoteException warning: `plot` (lib) generated 8 warnings (run `cargo fix --lib -p plot` to apply 8 suggestions) Finished `release` profile [optimized] target(s) in 21.20s
In [ ]:
{ pwsh ../apps/dir-tree-html/build.ps1 } | Invoke-Block
00:00:00 d #1 spiral.main / { args = Array(MutCell(["dib", "--path", "DirTreeHtml.dib"])) } 00:00:00 d #2 runtime.execute_with_options / { file_name = dotnet; arguments = ["repl", "--exit-after-run", "--run", "/home/runner/work/polyglot/polyglot/apps/dir-tree-html/DirTreeHtml.dib", "--output-path", "/home/runner/work/polyglot/polyglot/apps/dir-tree-html/DirTreeHtml.dib.ipynb"]; options = { command = dotnet repl --exit-after-run --run "/home/runner/work/polyglot/polyglot/apps/dir-tree-html/DirTreeHtml.dib" --output-path "/home/runner/work/polyglot/polyglot/apps/dir-tree-html/DirTreeHtml.dib.ipynb"; cancellation_token = None; environment_variables = Array(MutCell([("TRACE_LEVEL", "Verbose"), ("AUTOMATION", "True")])); on_line = None; stdin = None; trace = false; working_directory = None; stderr = true } } > > ── markdown ──────────────────────────────────────────────────────────────────── > │ # DirTreeHtml (Polyglot) > > ── fsharp ────────────────────────────────────────────────────────────────────── > #r > @"../../../../../../../.nuget/packages/fsharp.control.asyncseq/3.2.1/lib/netstan > dard2.1/FSharp.Control.AsyncSeq.dll" > #r > @"../../../../../../../.nuget/packages/system.reactive/6.0.1-preview.1/lib/net6. > 0/System.Reactive.dll" > #r > @"../../../../../../../.nuget/packages/system.reactive.linq/6.0.1-preview.1/lib/ > netstandard2.0/System.Reactive.Linq.dll" > #r > @"../../../../../../../.nuget/packages/argu/6.2.4/lib/netstandard2.0/Argu.dll" > #r > @"../../../../../../../.nuget/packages/falco.markup/1.1.1/lib/netstandard2.0/Fal > co.Markup.dll" > > ── fsharp ────────────────────────────────────────────────────────────────────── > #if !INTERACTIVE > open Lib > #endif > > ── fsharp ────────────────────────────────────────────────────────────────────── > open SpiralFileSystem.Operators > open Falco.Markup > > ── fsharp ────────────────────────────────────────────────────────────────────── > type FileSystemNode = > | File of string * string * int64 > | Folder of string * string * FileSystemNode list > | Root of FileSystemNode list > > let rec scanDirectory isRoot (basePath : string) (path : string) = > let relativePath = > path > |> SpiralSm.replace basePath "" > |> SpiralSm.replace "\\" "/" > |> SpiralSm.replace "//" "/" > |> SpiralSm.trim_start [[| '/' |]] > > let directories = > path > |> System.IO.Directory.GetDirectories > |> Array.toList > |> List.sort > |> List.map (scanDirectory false basePath) > let files = > path > |> System.IO.Directory.GetFiles > |> Array.toList > |> List.sort > |> List.map (fun f -> File (System.IO.Path.GetFileName f, relativePath, > System.IO.FileInfo(f).Length)) > > let children = directories @ files > if isRoot > then Root children > else Folder (path |> System.IO.Path.GetFileName, relativePath, children) > > let rec generateHtml fsNode = > let sizeLabel size = > match float size with > | size when size > 1024.0 * 1024.0 -> $"%.2f{size / 1024.0 / 1024.0} MB" > | size when size > 1024.0 -> $"%.2f{size / 1024.0} KB" > | size -> $"%.2f{size} B" > match fsNode with > | File (fileName, relativePath, size) -> > Elem.div [[]] [[ > Text.raw "📄 " > Elem.a [[ > Attr.href $"""{relativePath}{if relativePath = "" then "" else > "/"}{fileName}""" > ]] [[ > Text.raw fileName > ]] > Elem.span [[]] [[ > Text.raw $" ({size |> sizeLabel})" > ]] > ]] > | Folder (folderName, relativePath, children) -> > let size = > let rec 루프 children = > children > |> List.sumBy (function > | File (_, _, size) -> size > | Folder (_, _, children) > | Root children -> 루프 children > ) > 루프 children > Elem.details [[ > Attr.open' "true" > ]] [[ > Elem.summary [[]] [[ > Text.raw "📂 " > Elem.a [[ > Attr.href relativePath > ]] [[ > Text.raw folderName > ]] > Elem.span [[]] [[ > Text.raw $" ({size |> sizeLabel})" > ]] > ]] > Elem.div [[]] [[ > yield! children |> List.map generateHtml > ]] > ]] > | Root children -> > Elem.div [[]] [[ > yield! children |> List.map generateHtml > ]] > > let generateHtmlForFileSystem root = > $"""<!DOCTYPE html> > <html lang="en"> > <head> > <meta charset="UTF-8"> > <style> > body {{ > background-color: #222; > color: #ccc; > }} > a {{ > color: #777; > font-size: 15px; > }} > span {{ > font-size: 11px; > }} > div > div {{ > padding-left: 10px; > }} > details > div {{ > padding-left: 19px; > }} > </style> > </head> > <body> > {root |> generateHtml |> renderNode} > </body> > </html> > """ > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let expected = """<!DOCTYPE html> > <html lang="en"> > <head> > <meta charset="UTF-8"> > <style> > body { > background-color: #222; > color: #ccc; > } > a { > color: #777; > font-size: 15px; > } > span { > font-size: 11px; > } > div > div { > padding-left: 10px; > } > details > div { > padding-left: 19px; > } > </style> > </head> > <body> > <div><details open="true"><summary>📂 <a href="_.root">_.root</a><span> > (10.00 B)</span></summary><div><details open="true"><summary>📂 <a > href="_.root/3">3</a><span> (6.00 B)</span></summary><div><details > open="true"><summary>📂 <a href="_.root/3/2">2</a><span> (3.00 > B)</span></summary><div><details open="true"><summary>📂 <a > href="_.root/3/2/1">1</a><span> (1.00 B)</span></summary><div><div>📄 <a > href="_.root/3/2/1/file.txt">file.txt</a><span> (1.00 > B)</span></div></div></details><div>📄 <a > href="_.root/3/2/file.txt">file.txt</a><span> (2.00 > B)</span></div></div></details><div>📄 <a > href="_.root/3/file.txt">file.txt</a><span> (3.00 > B)</span></div></div></details><div>📄 <a > href="_.root/file.txt">file.txt</a><span> (4.00 > B)</span></div></div></details></div> > </body> > </html> > """ > > let struct (tempFolder, disposable) = expected |> SpiralCrypto.hash_text |> > SpiralFileSystem.create_temp_dir' > let rec 루프 d n = async { > if n >= 0 then > tempFolder </> d |> System.IO.Directory.CreateDirectory |> ignore > do! > n > |> string > |> String.replicate (n + 1) > |> SpiralFileSystem.write_all_text_async (tempFolder </> d </> > $"file.txt") > do! 루프 $"{d}/{n}" (n - 1) > } > 루프 "_.root" 3 > |> Async.RunSynchronously > > let html = > scanDirectory true tempFolder tempFolder > |> generateHtmlForFileSystem > > html > |> _assertEqual expected > > disposable.Dispose () > > html |> Microsoft.DotNet.Interactive.Formatting.Html.ToHtmlContent > > ── [ 117.11ms - return value ] ───────────────────────────────────────────────── > │ <!DOCTYPE html> > │ <html lang="en"> > │ <head> > │ <meta charset="UTF-8"> > │ <style> > │ body { > │ background-color: #222; > │ color: #ccc; > │ } > │ a { > │ color: #777; > │ font-size: 15px; > │ } > │ span { > │ font-size: 11px; > │ } > │ div > div { > │ padding-left: 10px; > │ } > │ details > div { > │ padding-left: 19px; > │ } > │ </style> > │ </head> > │ <body> > │ <div><details open="true"><summary>📂 <a > href="_.root">_.root</a><span> (10.00 B)</span></summary><div><details > open="true"><summary>📂 <a href="_.root/3">3</a><span> (6.00 > B)</span></summary><div><details open="true"><summary>📂 <a > href="_.root/3/2">2</a><span> (3.00 B)</span></summary><div><details > open="true"><summary>📂 <a href="_.root/3/2/1">1</a><span> (1.00 > B)</span></summary><div><div>📄 <a > href="_.root/3/2/1/file.txt">file.txt</a><span> (1.00 > B)</span></div></div></details><div>📄 <a > href="_.root/3/2/file.txt">file.txt</a><span> (2.00 > B)</span></div></div></details><div>📄 <a > href="_.root/3/file.txt">file.txt</a><span> (3.00 > B)</span></div></div></details><div>📄 <a > href="_.root/file.txt">file.txt</a><span> (4.00 > B)</span></div></div></details></div> > │ </body> > │ </html> > │ > > ── [ 120.55ms - stdout ] ─────────────────────────────────────────────────────── > │ "<!DOCTYPE html> > │ <html lang="en"> > │ <head> > │ <meta charset="UTF-8"> > │ <style> > │ body { > │ background-color: #222; > │ color: #ccc; > │ } > │ a { > │ color: #777; > │ font-size: 15px; > │ } > │ span { > │ font-size: 11px; > │ } > │ div > div { > │ padding-left: 10px; > │ } > │ details > div { > │ padding-left: 19px; > │ } > │ </style> > │ </head> > │ <body> > │ <div><details open="true"><summary>📂 <a > href="_.root">_.root</a><span> (10.00 B)</span></summary><div><details > open="true"><summary>📂 <a href="_.root/3">3</a><span> (6.00 > B)</span></summary><div><details open="true"><summary>📂 <a > href="_.root/3/2">2</a><span> (3.00 B)</span></summary><div><details > open="true"><summary>📂 <a href="_.root/3/2/1">1</a><span> (1.00 > B)</span></summary><div><div>📄 <a > href="_.root/3/2/1/file.txt">file.txt</a><span> (1.00 > B)</span></div></div></details><div>📄 <a > href="_.root/3/2/file.txt">file.txt</a><span> (2.00 > B)</span></div></div></details><div>📄 <a > href="_.root/3/file.txt">file.txt</a><span> (3.00 > B)</span></div></div></details><div>📄 <a > href="_.root/file.txt">file.txt</a><span> (4.00 > B)</span></div></div></details></div> > │ </body> > │ </html> > │ " > │ > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## Arguments > > ── fsharp ────────────────────────────────────────────────────────────────────── > [[<RequireQualifiedAccess>]] > type Arguments = > | [[<Argu.ArguAttributes.ExactlyOnce>]] Dir of string > | [[<Argu.ArguAttributes.ExactlyOnce>]] Html of string > > interface Argu.IArgParserTemplate with > member s.Usage = > match s with > | Dir _ -> nameof Dir > | Html _ -> nameof Html > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > Argu.ArgumentParser.Create<Arguments>().PrintUsage () > > ── [ 65.06ms - return value ] ────────────────────────────────────────────────── > │ "USAGE: dotnet-repl [--help] --dir <string> --html <string> > │ > │ OPTIONS: > │ > │ --dir <string> Dir > │ --html <string> Html > │ --help display this list of options. > │ " > │ > > ── markdown ──────────────────────────────────────────────────────────────────── > │ ## main > > ── fsharp ────────────────────────────────────────────────────────────────────── > let main args = > let argsMap = args |> Runtime.parseArgsMap<Arguments> > > let dir = > match argsMap.[[nameof Arguments.Dir]] with > | [[ Arguments.Dir dir ]] -> Some dir > | _ -> None > |> Option.get > > let htmlPath = > match argsMap.[[nameof Arguments.Html]] with > | [[ Arguments.Html html ]] -> Some html > | _ -> None > |> Option.get > > let fileSystem = scanDirectory true dir dir > let html = generateHtmlForFileSystem fileSystem > > html |> SpiralFileSystem.write_all_text_async htmlPath > |> Async.runWithTimeout 30000 > |> function > | Some () -> 0 > | None -> 1 > > ── fsharp ────────────────────────────────────────────────────────────────────── > //// test > > let args = > System.Environment.GetEnvironmentVariable "ARGS" > |> SpiralRuntime.split_args > |> Result.toArray > |> Array.collect id > > match args with > | [[||]] -> 0 > | args -> if main args = 0 then 0 else failwith "main failed" > > ── [ 61.61ms - return value ] ────────────────────────────────────────────────── > │ <div class="dni-plaintext"><pre>0 > │ </pre></div><style> > │ .dni-code-hint { > │ font-style: italic; > │ overflow: hidden; > │ white-space: nowrap; > │ } > │ .dni-treeview { > │ white-space: nowrap; > │ } > │ .dni-treeview td { > │ vertical-align: top; > │ text-align: start; > │ } > │ details.dni-treeview { > │ padding-left: 1em; > │ } > │ table td { > │ text-align: start; > │ } > │ table tr { > │ vertical-align: top; > │ margin: 0em 0px; > │ } > │ table tr td pre > │ { > │ vertical-align: top !important; > │ margin: 0em 0px !important; > │ } > │ table th { > │ text-align: start; > │ } > │ </style> 00:00:17 v #3 runtime.execute_with_options / result / { file_name = dotnet; exit_code = 0; std_trace_length = 13907 } 00:00:17 d #4 runtime.execute_with_options / { file_name = jupyter; arguments = ["nbconvert", "/home/runner/work/polyglot/polyglot/apps/dir-tree-html/DirTreeHtml.dib.ipynb", "--to", "html", "--HTMLExporter.theme=dark"]; options = { command = jupyter nbconvert "/home/runner/work/polyglot/polyglot/apps/dir-tree-html/DirTreeHtml.dib.ipynb" --to html --HTMLExporter.theme=dark; cancellation_token = None; environment_variables = Array(MutCell([])); on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:00:17 v #5 ! [NbConvertApp] Converting notebook /home/runner/work/polyglot/polyglot/apps/dir-tree-html/DirTreeHtml.dib.ipynb to html 00:00:17 v #6 ! /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/nbformat/__init__.py:96: MissingIDFieldWarning: Cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future. 00:00:17 v #7 ! validate(nb) 00:00:18 v #8 ! /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/nbconvert/filters/highlight.py:71: UserWarning: IPython3 lexer unavailable, falling back on Python 3 00:00:18 v #9 ! return _pygments_highlight( 00:00:18 v #10 ! [NbConvertApp] Writing 310043 bytes to /home/runner/work/polyglot/polyglot/apps/dir-tree-html/DirTreeHtml.dib.html 00:00:18 v #11 runtime.execute_with_options / result / { file_name = jupyter; exit_code = 0; std_trace_length = 924 } 00:00:18 d #12 spiral.process_dib / dib / jupyter nbconvert / { exit_code = 0; jupyter_result_length = 924 } 00:00:18 d #13 runtime.execute_with_options / { file_name = pwsh; arguments = ["-c", "$counter = 1; $path = '/home/runner/work/polyglot/polyglot/apps/dir-tree-html/DirTreeHtml.dib.html'; (Get-Content $path -Raw) -replace '(id=\\\"cell-id=)[a-fA-F0-9]{8}', { $_.Groups[1].Value + $counter++ } | Set-Content $path"]; options = { command = pwsh -c "$counter = 1; $path = '/home/runner/work/polyglot/polyglot/apps/dir-tree-html/DirTreeHtml.dib.html'; (Get-Content $path -Raw) -replace '(id=\"cell-id=)[a-fA-F0-9]{8}', { $_.Groups[1].Value + $counter++ } | Set-Content $path"; cancellation_token = None; environment_variables = Array(MutCell([])); on_line = None; stdin = None; trace = true; working_directory = None; stderr = true } } 00:00:18 v #14 runtime.execute_with_options / result / { file_name = pwsh; exit_code = 0; std_trace_length = 0 } 00:00:18 d #15 spiral.run / dib / html cell ids / { exit_code = 0; pwsh_replace_html_result_length = 0 } 00:00:18 d #16 spiral.process_dib / dib / { exit_code = 0; result_length = 14890 } 00:00:00 d #1 writeDibCode / output: Fs / path: DirTreeHtml.dib 00:00:00 d #2 parseDibCode / output: Fs / file: DirTreeHtml.dib 00:00:00 d #1 persistCodeProject / packages: [Argu; Falco.Markup; FSharp.Control.AsyncSeq; ... ] / modules: [deps/spiral/lib/spiral/common.fsx; deps/spiral/lib/spiral/sm.fsx; deps/spiral/lib/spiral/crypto.fsx; ... ] / name: DirTreeHtml / hash: / code.Length: 4632 00:00:00 d #2 buildProject / fullPath: /home/runner/work/polyglot/polyglot/target/Builder/DirTreeHtml/DirTreeHtml.fsproj 00:00:00 d #1 runtime.execute_with_options_async / { file_name = dotnet; arguments = US5_0 "publish "/home/runner/work/polyglot/polyglot/target/Builder/DirTreeHtml/DirTreeHtml.fsproj" --configuration Release --output "/home/runner/work/polyglot/polyglot/apps/dir-tree-html/dist" --runtime linux-x64"; options = { command = dotnet publish "/home/runner/work/polyglot/polyglot/target/Builder/DirTreeHtml/DirTreeHtml.fsproj" --configuration Release --output "/home/runner/work/polyglot/polyglot/apps/dir-tree-html/dist" --runtime linux-x64; cancellation_token = None; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot/target/Builder/DirTreeHtml"; stderr = true } } 00:00:00 v #2 > Determining projects to restore... 00:00:01 v #3 > Paket version 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 00:00:01 v #4 > The last full restore is still up to date. Nothing left to do. 00:00:01 v #5 > Total time taken: 0 milliseconds 00:00:01 v #6 > Paket version 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0 00:00:01 v #7 > Restoring /home/runner/work/polyglot/polyglot/target/Builder/DirTreeHtml/DirTreeHtml.fsproj 00:00:01 v #8 > Starting restore process. 00:00:01 v #9 > Total time taken: 0 milliseconds 00:00:02 v #10 > Restored /home/runner/work/polyglot/polyglot/target/Builder/DirTreeHtml/DirTreeHtml.fsproj (in 268 ms). 00:00:13 v #11 > DirTreeHtml -> /home/runner/work/polyglot/polyglot/target/Builder/DirTreeHtml/bin/Release/net9.0/linux-x64/DirTreeHtml.dll 00:00:14 v #12 > DirTreeHtml -> /home/runner/work/polyglot/polyglot/apps/dir-tree-html/dist 00:00:14 d #13 runtime.execute_with_options_async / { exit_code = 0; output_length = 728; options = { command = dotnet publish "/home/runner/work/polyglot/polyglot/target/Builder/DirTreeHtml/DirTreeHtml.fsproj" --configuration Release --output "/home/runner/work/polyglot/polyglot/apps/dir-tree-html/dist" --runtime linux-x64; cancellation_token = None; environment_variables = [||]; on_line = None; stdin = None; trace = true; working_directory = Some "/home/runner/work/polyglot/polyglot/target/Builder/DirTreeHtml"; stderr = true } } polyglot/apps/dir-tree-html/build.ps1 / $env:CI:'true'
In [ ]:
{ pwsh ./outdated.ps1 } | Invoke-Block
Paket version 9.0.2+a9b12aaeb8d8d5e47a415a3442b7920ed04e98e0
Resolving dependency graph...
Could not detect any platforms from 'net10.0' in Microsoft.AspNetCore.Connections.Abstractions 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in System.Management 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in Microsoft.AspNetCore.Http.Connections.Common 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in Microsoft.AspNetCore.Http.Connections.Client 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in Microsoft.AspNetCore.SignalR.Common 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in Microsoft.AspNetCore.SignalR.Client 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in Microsoft.AspNetCore.SignalR.Client.Core 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in Microsoft.AspNetCore.SignalR.Protocols.Json 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in Microsoft.Extensions.Features 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in System.IO.Pipelines 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in Microsoft.Extensions.Logging.Abstractions 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in Microsoft.Extensions.Options 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in System.Net.ServerSentEvents 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in System.Text.Json 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in Microsoft.Extensions.DependencyInjection 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in Microsoft.Extensions.Logging 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in System.Threading.Channels 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in System.CodeDom 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in Microsoft.Extensions.DependencyInjection.Abstractions 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in System.Diagnostics.DiagnosticSource 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in Microsoft.Extensions.Primitives 10.0.0-rc.2.25502.107, please tell the package authors
Could not detect any platforms from 'net10.0' in System.Text.Encodings.Web 10.0.0-rc.2.25502.107, please tell the package authors
Outdated packages found:
Group: Main
* Argu 6.2.4 -> 6.2.5
* Expecto.FsCheck 11.0.0-alpha8 -> 11.0.0-alpha8-fscheck2
* Fable.Core 4.3 -> 5.0.0-beta.1
* Falco.Markup 1.1.1 -> 1.4.0
* FsCheck 3.1 -> 2.16.6
* FSharp.Core 9.0.303 -> 10.0.100-rc2.25502.107
* Microsoft.AspNetCore.App.Runtime.linux-x64 9.0.3 -> 10.0.0-rc.2.25502.107
* Microsoft.AspNetCore.App.Runtime.win-x64 9.0.3 -> 10.0.0-rc.2.25502.107
* Microsoft.AspNetCore.Connections.Abstractions 7.0 -> 10.0.0-rc.2.25502.107
* Microsoft.AspNetCore.Http.Connections.Client 7.0 -> 10.0.0-rc.2.25502.107
* Microsoft.AspNetCore.Http.Connections.Common 7.0 -> 10.0.0-rc.2.25502.107
* Microsoft.AspNetCore.SignalR.Client 7.0 -> 10.0.0-rc.2.25502.107
* Microsoft.AspNetCore.SignalR.Client.Core 7.0 -> 10.0.0-rc.2.25502.107
* Microsoft.AspNetCore.SignalR.Common 7.0 -> 10.0.0-rc.2.25502.107
* Microsoft.AspNetCore.SignalR.Protocols.Json 7.0 -> 10.0.0-rc.2.25502.107
* Microsoft.Bcl.AsyncInterfaces 9.0.10 -> 10.0.0-rc.2.25502.107
* Microsoft.Extensions.DependencyInjection 9.0.10 -> 10.0.0-rc.2.25502.107
* Microsoft.Extensions.DependencyInjection.Abstractions 9.0.10 -> 10.0.0-rc.2.25502.107
* Microsoft.Extensions.Features 7.0 -> 10.0.0-rc.2.25502.107
* Microsoft.Extensions.Logging 9.0.10 -> 10.0.0-rc.2.25502.107
* Microsoft.Extensions.Logging.Abstractions 9.0.10 -> 10.0.0-rc.2.25502.107
* Microsoft.Extensions.Options 9.0.10 -> 10.0.0-rc.2.25502.107
* Microsoft.Extensions.Primitives 9.0.10 -> 10.0.0-rc.2.25502.107
* System.CodeDom 9.0.10 -> 10.0.0-rc.2.25502.107
* System.IO.Pipelines 9.0.10 -> 10.0.0-rc.2.25502.107
* System.Management 7.0 -> 10.0.0-rc.2.25502.107
* System.Reactive.Linq 6.0.2 -> 6.1.0
* System.Threading.Channels 9.0.10 -> 10.0.0-rc.2.25502.107
Total time taken: 5 seconds
Paket omitted 22 warnings. You can see them in verbose mode.
CheckToml / toml: /home/runner/work/polyglot/polyglot/workspace/Cargo.toml
All dependencies are up to date, yay!
CheckToml / toml: /home/runner/work/polyglot/polyglot/apps/chat/contract/Cargo.toml
error: failed to read `/home/runner/work/polyglot/polyglot/apps/chat/contract/Cargo.toml`
System.Management.Automation.RemoteException
Caused by:
No such file or directory (os error 2)
# Invoke-Block / $retry: 1/1 / $Location: / Get-Location: /home/runner/work/polyglot/polyglot/scripts / $OnError: Continue / $exitcode: 1 / $Error: '' / $ScriptBlock:
'cargo outdated -m $toml @_args'
/ $result:
''
/ $output:
''
CheckToml / toml: /home/runner/work/polyglot/polyglot/apps/chat/contract/tests/Cargo.toml
error: failed to read `/home/runner/work/polyglot/polyglot/apps/chat/contract/tests/Cargo.toml`
System.Management.Automation.RemoteException
Caused by:
No such file or directory (os error 2)
# Invoke-Block / $retry: 1/1 / $Location: / Get-Location: /home/runner/work/polyglot/polyglot/scripts / $OnError: Continue / $exitcode: 1 / $Error: '' / $ScriptBlock:
'cargo outdated -m $toml @_args'
/ $result:
''
/ $output:
''
CheckToml / toml: /home/runner/work/polyglot/polyglot/apps/plot/Cargo.toml
error: failed to parse manifest at `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/block-buffer-0.11.0-rc.5/Cargo.toml`
System.Management.Automation.RemoteException
Caused by:
feature `edition2024` is required
System.Management.Automation.RemoteException
The package requires the Cargo feature called `edition2024`, but that feature is not stabilized in this version of Cargo (1.81.0).
Consider trying a more recent nightly release.
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2024 for more information about the status of this feature.
# Invoke-Block / $retry: 1/1 / $Location: / Get-Location: /home/runner/work/polyglot/polyglot/scripts / $OnError: Continue / $exitcode: 1 / $Error: '' / $ScriptBlock:
'cargo outdated -m $toml @_args'
/ $result:
''
/ $output:
''
CheckJson / json: /home/runner/work/polyglot/polyglot
$ npm-check-updates --target greatest
Using bun
Checking /home/runner/work/polyglot/polyglot/package.json
System.Management.Automation.RemoteException
@types/node ~22.10 → ~24.9
npm-check-updates ~17.1.14 → ~19.1.1
Run ncu --target greatest -u to upgrade package.json
CheckJson / json: /home/runner/work/polyglot/polyglot/apps/ipfs
ENOENT: Could not change directory to "/home/runner/work/polyglot/polyglot/apps/ipfs"
# Invoke-Block / $retry: 1/1 / $Location: / Get-Location: /home/runner/work/polyglot/polyglot/scripts / $OnError: Continue / $exitcode: 1 / $Error: '' / $ScriptBlock:
'. $(Search-Command bun) --bun --cwd $json outdated-pre'
/ $result:
''
/ $output:
''
CheckJson / json: /home/runner/work/polyglot/polyglot/apps/spiral/temp/extension
ENOENT: Could not change directory to "/home/runner/work/polyglot/polyglot/apps/spiral/temp/extension"
# Invoke-Block / $retry: 1/1 / $Location: / Get-Location: /home/runner/work/polyglot/polyglot/scripts / $OnError: Continue / $exitcode: 1 / $Error: '' / $ScriptBlock:
'. $(Search-Command bun) --bun --cwd $json outdated-pre'
/ $result:
''
/ $output:
''
CheckJson / json: /home/runner/work/polyglot/polyglot/apps/spiral/vscode
ENOENT: Could not change directory to "/home/runner/work/polyglot/polyglot/apps/spiral/vscode"
# Invoke-Block / $retry: 1/1 / $Location: / Get-Location: /home/runner/work/polyglot/polyglot/scripts / $OnError: Continue / $exitcode: 1 / $Error: '' / $ScriptBlock:
'. $(Search-Command bun) --bun --cwd $json outdated-pre'
/ $result:
''
/ $output:
''
CheckJson / json: /home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/VS Code Plugin
$ npm-check-updates --target greatest
Checking /home/runner/work/polyglot/polyglot/deps/The-Spiral-Language/VS Code Plugin/package.json
System.Management.Automation.RemoteException
@microsoft/signalr 8.0.0 → 9.0.6
@types/node ~22.10 → ~24.9
@types/vscode ~1.95 → ~1.105
@vscode/vsce ~3.2 → ~3.6-0
esbuild ~0.24 → ~0.25
npm-check-updates ~17.1.14 → ~19.1.1
portfinder ^1.0.32 → ^1.0.38
Run ncu --target greatest -u to upgrade package.json