diff --git a/implement/Pine.Core/Pine.Core.csproj b/implement/Pine.Core/Pine.Core.csproj index 3490079a..df56d995 100644 --- a/implement/Pine.Core/Pine.Core.csproj +++ b/implement/Pine.Core/Pine.Core.csproj @@ -3,13 +3,13 @@ net8.0 enable - 0.3.14 - 0.3.14 + 0.3.15 + 0.3.15 Pine.Core - 0.3.14 + 0.3.15 The cross-platform Elm runtime environment Functional;Elm;Runtime;Compiler;VM;DBMS https://github.com/pine-vm/pine.git diff --git a/implement/pine/ElmTime/compile-elm-program/src/FirCompiler.elm b/implement/pine/ElmTime/compile-elm-program/src/FirCompiler.elm index 74a7d97b..961a1fe5 100644 --- a/implement/pine/ElmTime/compile-elm-program/src/FirCompiler.elm +++ b/implement/pine/ElmTime/compile-elm-program/src/FirCompiler.elm @@ -901,63 +901,41 @@ The first element in the list is a set of declarations that do not depend on any recursionDomainsFromDeclarationDependencies : List ( String, Set.Set String ) -> List (Set.Set String) recursionDomainsFromDeclarationDependencies declarationDependencies = let - integrateDecl ( declName, declDependencies ) recursionDomains = - let - -- Inserts the new domain into the list of domains at the position where the none of the following domains depend on it. - insertDomainRecursive : - Set.Set String - -> List (Set.Set String) - -> List (Set.Set String) - -> List (Set.Set String) - insertDomainRecursive domainToInsert skipped following = - case following of - [] -> - skipped ++ [ domainToInsert ] - - next :: rest -> - let - allCurrentAndFollowing : Set.Set String - allCurrentAndFollowing = - List.foldl Set.union next rest - - dependingOnAnyCurrentOrFollowing : Bool - dependingOnAnyCurrentOrFollowing = - not (Set.isEmpty (Set.intersect declDependencies allCurrentAndFollowing)) - - allDependenciesOfNext : Set.Set String - allDependenciesOfNext = - Set.foldl - (\nextDeclName aggregate -> - case Common.assocListGet nextDeclName declarationDependencies of - Nothing -> - aggregate - - Just nextDeclDependencies -> - Set.union nextDeclDependencies aggregate - ) - Set.empty - next - - nextDependingOnNewDomain : Bool - nextDependingOnNewDomain = - Set.member declName allDependenciesOfNext - in - if dependingOnAnyCurrentOrFollowing then - if nextDependingOnNewDomain then - -- Merge the new domain into the current domain - List.concat - [ skipped, [ Set.union domainToInsert next ], rest ] - - else - insertDomainRecursive domainToInsert (skipped ++ [ next ]) rest + depsGroups : List (Set.Set String) + depsGroups = + List.map + (\( declName, declDependencies ) -> Set.insert declName declDependencies) + declarationDependencies + + depsGroupsUniqueOrdered : List (Set.Set String) + depsGroupsUniqueOrdered = + List.sortBy Set.size (Common.listUnique depsGroups) + + deriveDomainsRecursive : + Set.Set String + -> List (Set.Set String) + -> List (Set.Set String) + -> List (Set.Set String) + deriveDomainsRecursive covered groups domains = + case groups of + [] -> + List.reverse domains - else - List.concat - [ skipped, [ domainToInsert ], following ] - in - insertDomainRecursive (Set.singleton declName) [] recursionDomains + nextGroup :: remainingGroups -> + let + domain : Set.Set String + domain = + Set.filter + (\name -> not (Set.member name covered)) + nextGroup + + coveredNext : Set.Set String + coveredNext = + Set.union nextGroup covered + in + deriveDomainsRecursive coveredNext remainingGroups (domain :: domains) in - List.foldl integrateDecl [] declarationDependencies + deriveDomainsRecursive Set.empty depsGroupsUniqueOrdered [] parseFunctionParameters : Expression -> DeclBlockFunctionEntry diff --git a/implement/pine/Program.cs b/implement/pine/Program.cs index 5c5ec138..c66a8571 100644 --- a/implement/pine/Program.cs +++ b/implement/pine/Program.cs @@ -18,7 +18,7 @@ namespace ElmTime; public class Program { - public static string AppVersionId => "0.3.14"; + public static string AppVersionId => "0.3.15"; private static int AdminInterfaceDefaultPort => 4000; diff --git a/implement/pine/pine.csproj b/implement/pine/pine.csproj index 63b11c50..330d8108 100644 --- a/implement/pine/pine.csproj +++ b/implement/pine/pine.csproj @@ -4,8 +4,8 @@ Exe net8.0 pine - 0.3.14 - 0.3.14 + 0.3.15 + 0.3.15 enable true