diff --git a/implement/Pine/Pine.csproj b/implement/Pine/Pine.csproj index d6372bf3..7a61a546 100644 --- a/implement/Pine/Pine.csproj +++ b/implement/Pine/Pine.csproj @@ -3,13 +3,13 @@ net8.0 enable - 0.1.4 - 0.1.4 + 0.1.5 + 0.1.5 Pine - 0.1.4 + 0.1.5 The cross-platform Elm runtime environment Functional;Elm;Runtime;Compiler;VM;DBMS https://github.com/elm-time/elm-time.git diff --git a/implement/elm-time/ElmTime/compile-elm-program/src/ElmCompiler.elm b/implement/elm-time/ElmTime/compile-elm-program/src/ElmCompiler.elm index e07ac0b0..4b871c75 100644 --- a/implement/elm-time/ElmTime/compile-elm-program/src/ElmCompiler.elm +++ b/implement/elm-time/ElmTime/compile-elm-program/src/ElmCompiler.elm @@ -240,7 +240,7 @@ elmDeclarationsToExposeToGlobalDefaultQualifiedNames = |> Dict.toList |> List.map (\( name, moduleName ) -> - String.join "." moduleName ++ "." ++ name + String.join "." (List.concat [ moduleName, [ name ] ]) ) |> Set.fromList @@ -274,7 +274,7 @@ elmDeclarationsOverridesExpressions = [ ( declarationName , LiteralExpression declarationValue ) - , ( String.join "." (moduleName ++ [ declarationName ]) + , ( String.join "." (List.concat [ moduleName, [ declarationName ] ]) , LiteralExpression declarationValue ) ] @@ -311,13 +311,15 @@ expandElmInteractiveEnvironmentWithModules environmentBefore newParsedElmModules of Err ( file, error ) -> Err - ("Failed to resolve dependencies for module " - ++ String.join "." + (String.join "" + [ "Failed to resolve dependencies for module " + , String.join "." (Elm.Syntax.Module.moduleName (Elm.Syntax.Node.value file.parsedModule.moduleDefinition) ) - ++ ": " - ++ error + , ": " + , error + ] ) Ok modulesWithDependencies -> @@ -366,14 +368,16 @@ expandElmInteractiveEnvironmentWithModules environmentBefore newParsedElmModules of Err error -> Err - ("Failed to compile elm module '" - ++ String.join + (String.join "" + [ "Failed to compile elm module '" + , String.join "." (Elm.Syntax.Node.value (moduleNameFromSyntaxFile moduleToTranslate.parsedModule) ) - ++ "': " - ++ error + , "': " + , error + ] ) Ok ( moduleName, moduleValue ) -> @@ -539,7 +543,7 @@ compileElmModuleIntoNamedExports availableModules moduleToTranslate = [] Elm.Syntax.Declaration.InfixDeclaration infixDeclaration -> - [ ( "(" ++ Elm.Syntax.Node.value infixDeclaration.operator ++ ")" + [ ( String.join "" [ "(", Elm.Syntax.Node.value infixDeclaration.operator, ")" ] , Elm.Syntax.Node.value infixDeclaration.function ) ] @@ -607,7 +611,7 @@ compileElmModuleIntoNamedExports availableModules moduleToTranslate = (\functionName functionDeclaration -> case compileElmSyntaxFunction initialCompilationStack functionDeclaration of Err err -> - Err ("Failed to compile function '" ++ functionName ++ "': " ++ err) + Err (String.join "" [ "Failed to compile function '", functionName, "': ", err ]) Ok ( _, compiledFunction ) -> Ok compiledFunction @@ -768,7 +772,7 @@ compilationAndEmitStackFromModulesInCompilation availableModules { moduleAliases case typeDeclaration of ElmModuleRecordTypeDeclaration fields -> Just - ( String.join "." (importedModuleName ++ [ typeName ]) + ( String.join "." (List.concat [ importedModuleName, [ typeName ] ]) , fields ) @@ -796,7 +800,8 @@ compilationAndEmitStackFromModulesInCompilation availableModules { moduleAliases (\( tagName, tag ) -> let qualifiedName = - String.join "." (importedModuleName ++ [ tagName ]) + String.join "." + (List.concat [ importedModuleName, [ tagName ] ]) isAutoImported = Set.member @@ -911,7 +916,7 @@ compilationAndEmitStackFromModulesInCompilation availableModules { moduleAliases importedModule.functionDeclarations |> Dict.foldl (\declName -> - Dict.insert (String.join "." (moduleName ++ [ declName ])) + Dict.insert (String.join "." (List.concat [ moduleName, [ declName ] ])) ) modulesAggregate ) @@ -1190,7 +1195,9 @@ compileElmSyntaxExpression stack elmExpression = |> Result.mapError ((++) "Failed to compile right expression: ") |> Result.andThen (\rightExpression -> - compileElmFunctionOrValueLookup ( [], "(" ++ operator ++ ")" ) stack + compileElmFunctionOrValueLookup + ( [], String.join "" [ "(", operator, ")" ] ) + stack |> Result.map (\operationFunction -> FunctionApplicationExpression @@ -1202,7 +1209,7 @@ compileElmSyntaxExpression stack elmExpression = |> Result.mapError ((++) ("Failed to compile OperatorApplication '" ++ operator ++ "': ")) Elm.Syntax.Expression.PrefixOperator operator -> - compileElmFunctionOrValueLookup ( [], "(" ++ operator ++ ")" ) stack + compileElmFunctionOrValueLookup ( [], String.join "" [ "(", operator, ")" ] ) stack Elm.Syntax.Expression.IfBlock elmCondition elmExpressionIfTrue elmExpressionIfFalse -> case compileElmSyntaxExpression stack (Elm.Syntax.Node.value elmCondition) of @@ -1352,7 +1359,7 @@ compileElmSyntaxApplication stack appliedFunctionElmSyntax argumentsElmSyntax = else let functionFlatName = - String.join "." (functionModuleName ++ [ functionLocalName ]) + String.join "." (List.concat [ functionModuleName, [ functionLocalName ] ]) in case Dict.get functionFlatName elmDeclarationsOverridesExpressions of Just declarationOverride -> @@ -1625,7 +1632,7 @@ compileElmSyntaxRecordUpdate stack setters recordName = (\( fieldName, fieldExpr ) -> case compileElmSyntaxExpression stack fieldExpr of Err err -> - Err ("Failed to compile record update field '" ++ fieldName ++ "': " ++ err) + Err (String.join "" [ "Failed to compile record update field '", fieldName, "': ", err ]) Ok compiledFieldExpr -> Ok ( fieldName, compiledFieldExpr ) @@ -1979,10 +1986,12 @@ compileElmSyntaxPattern elmPattern = case conditionsAndDeclarationsFromItemPattern argIndex argPattern of Err err -> Err - ("Failed for named pattern argument " - ++ String.fromInt argIndex - ++ ": " - ++ err + (String.join "" + [ "Failed for named pattern argument " + , String.fromInt argIndex + , ": " + , err + ] ) Ok ok -> @@ -2475,7 +2484,7 @@ compileElmFunctionOrValueLookupWithoutLocalResolution : compileElmFunctionOrValueLookupWithoutLocalResolution ( moduleName, name ) compilation = let fusedName = - String.join "." (moduleName ++ [ name ]) + String.join "." (List.concat [ moduleName, [ name ] ]) in case Dict.get name elmDeclarationsOverridesExpressions of Just declarationOverride -> @@ -2499,19 +2508,20 @@ getDeclarationValueFromCompilation ( localModuleName, nameInModule ) compilation |> Maybe.withDefault localModuleName flatName = - String.join "." (canonicalModuleName ++ [ nameInModule ]) + String.join "." (List.concat [ canonicalModuleName, [ nameInModule ] ]) continueWithDefault () = case compilation.availableModules |> Dict.get canonicalModuleName of Nothing -> Err - ("Did not find module '" - ++ String.join "." canonicalModuleName - ++ "'. There are " - ++ (String.fromInt (Dict.size compilation.availableModules) - ++ " declarations in this scope: " - ++ String.join ", " (List.map (String.join ".") (Dict.keys compilation.availableModules)) - ) + (String.join "" + [ "Did not find module '" + , String.join "." canonicalModuleName + , "'. There are " + , String.fromInt (Dict.size compilation.availableModules) + , " declarations in this scope: " + , String.join ", " (List.map (String.join ".") (Dict.keys compilation.availableModules)) + ] ) Just moduleValue -> @@ -2523,14 +2533,16 @@ getDeclarationValueFromCompilation ( localModuleName, nameInModule ) compilation Nothing -> Err - ("Did not find '" - ++ nameInModule - ++ "' in module '" - ++ String.join "." canonicalModuleName - ++ "'. There are " - ++ String.fromInt (Dict.size moduleValue.functionDeclarations) - ++ " function declarations available in that module: " - ++ String.join ", " (Dict.keys moduleValue.functionDeclarations) + (String.join "" + [ "Did not find '" + , nameInModule + , "' in module '" + , String.join "." canonicalModuleName + , "'. There are " + , String.fromInt (Dict.size moduleValue.functionDeclarations) + , " function declarations available in that module: " + , String.join ", " (Dict.keys moduleValue.functionDeclarations) + ] ) Just declarationValue -> @@ -2589,7 +2601,7 @@ compileLookupForInlineableDeclaration : ( List String, String ) -> Expression -> compileLookupForInlineableDeclaration ( moduleName, name ) expression = let fusedName = - String.join "." (moduleName ++ [ name ]) + String.join "." (List.concat [ moduleName, [ name ] ]) in if shouldInlineDeclaration name expression then expression @@ -2612,7 +2624,7 @@ emitModuleValue parsedModule = emittedFunctions = Dict.toList parsedModule.functionDeclarations in - (emittedFunctions ++ typeDescriptions) + List.concat [ emittedFunctions, typeDescriptions ] |> List.map Pine.valueFromContextExpansionWithName |> Pine.ListValue @@ -2749,7 +2761,7 @@ emitModuleFunctionDeclarations stackBefore declarations = |> Result.andThen (\emittedDomain -> emitRecursionDomainsRecursive - (alreadyEmitted ++ [ emittedDomain ]) + (List.concat [ alreadyEmitted, [ emittedDomain ] ]) followingRecursionDomains ) @@ -2780,7 +2792,8 @@ emitModuleFunctionDeclarations stackBefore declarations = availableEmittedFunctionsIncludingImports : List ( FirCompiler.EnvironmentFunctionEntry, Pine.Value ) availableEmittedFunctionsIncludingImports = - usedImportsAvailableEmittedFunctions ++ availableFunctionsValues + List.concat + [ usedImportsAvailableEmittedFunctions, availableFunctionsValues ] recursionDomainDeclarationsToIncludeInBlock : Set.Set String recursionDomainDeclarationsToIncludeInBlock = @@ -2927,10 +2940,12 @@ emitModuleFunctionDeclarations stackBefore declarations = ) |> Result.mapError (\err -> - "Failed in recursion domain: " - ++ String.join ", " (Set.toList currentRecursionDomain) - ++ ": " - ++ err + String.join "" + [ "Failed in recursion domain: " + , String.join ", " (Set.toList currentRecursionDomain) + , ": " + , err + ] ) |> Result.map (\emittedForExposeOrReuse -> @@ -2966,12 +2981,14 @@ emitModuleFunctionDeclarations stackBefore declarations = emittedDeclarations : List ( FirCompiler.EnvironmentFunctionEntry, ( Pine.Expression, Pine.Value ) ) emittedDeclarations = - emittedDeclarationsFromBlock - ++ List.filter + List.concat + [ emittedDeclarationsFromBlock + , List.filter (\( { functionName }, _ ) -> not (Set.member functionName emittedDeclarationsFromBlockNames) ) emittedDeclarationsFromExposed + ] exposedDeclarations : List ( String, Pine.Value ) exposedDeclarations = @@ -3176,7 +3193,7 @@ listModuleTransitiveDependencies : listModuleTransitiveDependencies allFiles file = case listModuleTransitiveDependenciesExcludingModules Set.empty allFiles file of Err ( modulePath, error ) -> - Err (error ++ ": " ++ String.join " -> " (List.map (String.join ".") modulePath)) + Err (String.join "" [ error, ": ", String.join " -> " (List.map (String.join ".") modulePath) ]) Ok ok -> Ok ok @@ -3285,11 +3302,12 @@ separateEnvironmentDeclarations environmentDeclarations = Result.andThen (\aggregate -> if stringStartsWithUpper declNameFlat then - getDeclarationsFromEnvironment declValue - |> Result.andThen parseModuleValue - |> Result.mapError ((++) ("Failed to parse module " ++ declNameFlat)) - |> Result.map - (\moduleDeclarations -> + case Result.andThen parseModuleValue (getDeclarationsFromEnvironment declValue) of + Err err -> + Err (String.join "" [ "Failed to parse module ", declNameFlat, ": ", err ]) + + Ok moduleDeclarations -> + Ok { aggregate | modules = Dict.insert @@ -3297,7 +3315,6 @@ separateEnvironmentDeclarations environmentDeclarations = ( declValue, moduleDeclarations ) aggregate.modules } - ) else Ok diff --git a/implement/elm-time/ElmTime/compile-elm-program/src/ElmInteractiveCoreModules.elm b/implement/elm-time/ElmTime/compile-elm-program/src/ElmInteractiveCoreModules.elm index 69fe3ac5..729a7cc6 100644 --- a/implement/elm-time/ElmTime/compile-elm-program/src/ElmInteractiveCoreModules.elm +++ b/implement/elm-time/ElmTime/compile-elm-program/src/ElmInteractiveCoreModules.elm @@ -1220,16 +1220,16 @@ join : String -> List String -> String join sep chunks = case sep of String sepList -> - String (joinOnList sepList (List.map toList chunks)) + String (joinOnList sepList chunks) -joinOnList : List Char -> List (List Char) -> List Char +joinOnList : List Char -> List String -> List Char joinOnList sep chunks = case chunks of [] -> [] - nextChunk :: remaining -> + (String nextChunk) :: remaining -> if remaining == [] then nextChunk diff --git a/implement/elm-time/ElmTime/compile-elm-program/src/FirCompiler.elm b/implement/elm-time/ElmTime/compile-elm-program/src/FirCompiler.elm index 58a97d8c..aa524bb4 100644 --- a/implement/elm-time/ElmTime/compile-elm-program/src/FirCompiler.elm +++ b/implement/elm-time/ElmTime/compile-elm-program/src/FirCompiler.elm @@ -477,7 +477,8 @@ emitDeclarationBlock stackBefore blockDeclarations config = } -> List a composeEnvironmentFunctions { prefix, forwarded, appendedFromDecls, appendedFromClosureCaptures } = - prefix ++ forwarded ++ appendedFromDecls ++ appendedFromClosureCaptures + List.concat + [ prefix, forwarded, appendedFromDecls, appendedFromClosureCaptures ] prefixEnvironmentFunctions : List EnvironmentFunctionEntry prefixEnvironmentFunctions = @@ -658,7 +659,7 @@ emitDeclarationBlock stackBefore blockDeclarations config = (\( functionName, blockDeclAsFunction ) -> case emitFunction blockDeclAsFunction of Err err -> - Err ("Failed to emit '" ++ functionName ++ "': " ++ err) + Err (String.join "" [ "Failed to emit '", functionName, "': ", err ]) Ok emittedExpression -> Ok ( functionName, ( blockDeclAsFunction, emittedExpression ) ) @@ -716,8 +717,10 @@ emitDeclarationBlock stackBefore blockDeclarations config = appendedEnvFunctionsExpressions : List Pine.Expression appendedEnvFunctionsExpressions = - newEnvFunctionsExpressionsFromDecls - ++ closureCapturesExpressions + List.concat + [ newEnvFunctionsExpressionsFromDecls + , closureCapturesExpressions + ] prevEnvFunctionsExpr : Pine.Expression prevEnvFunctionsExpr = @@ -733,9 +736,11 @@ emitDeclarationBlock stackBefore blockDeclarations config = envFunctionsExpression = Pine.ListExpression - (prependedEnvFunctionsExpressions - ++ forwardedItems - ++ appendedEnvFunctionsExpressions + (List.concat + [ prependedEnvFunctionsExpressions + , forwardedItems + , appendedEnvFunctionsExpressions + ] ) parseAndEmitFunction : Expression -> ( DeclarationBlockFunctionEntry, Result String Pine.Expression ) @@ -865,13 +870,15 @@ recursionDomainsFromDeclarationDependencies declarationDependencies = if dependingOnAnyCurrentOrFollowing then if nextDependingOnNewDomain then -- Merge the new domain into the current domain - skipped ++ [ Set.union domainToInsert next ] ++ rest + List.concat + [ skipped, [ Set.union domainToInsert next ], rest ] else insertDomainRecursive domainToInsert (skipped ++ [ next ]) rest else - skipped ++ [ domainToInsert ] ++ following + List.concat + [ skipped, [ domainToInsert ], following ] in insertDomainRecursive (Set.singleton declName) [] recursionDomains in @@ -914,16 +921,18 @@ emitReferenceExpression name compilation = case Dict.get name compilation.environmentDeconstructions of Nothing -> Err - ("Failed referencing '" - ++ name - ++ "'. " - ++ String.fromInt (Dict.size compilation.environmentDeconstructions) - ++ " deconstructions in scope: " - ++ String.join ", " (Dict.keys compilation.environmentDeconstructions) - ++ ". " - ++ String.fromInt (List.length compilation.environmentFunctions) - ++ " functions in scope: " - ++ String.join ", " (List.map .functionName compilation.environmentFunctions) + (String.join "" + [ "Failed referencing '" + , name + , "'. " + , String.fromInt (Dict.size compilation.environmentDeconstructions) + , " deconstructions in scope: " + , String.join ", " (Dict.keys compilation.environmentDeconstructions) + , ". " + , String.fromInt (List.length compilation.environmentFunctions) + , " functions in scope: " + , String.join ", " (List.map .functionName compilation.environmentFunctions) + ] ) Just deconstruction -> @@ -1092,10 +1101,12 @@ emitFunctionApplication functionExpression arguments compilation = case emitExpression compilation argumentExpression of Err err -> Err - ("Failed emitting argument " - ++ String.fromInt argumentIndex - ++ " for function application: " - ++ err + (String.join "" + [ "Failed emitting argument " + , String.fromInt argumentIndex + , " for function application: " + , err + ] ) Ok result -> @@ -1157,7 +1168,8 @@ emitFunctionApplication functionExpression arguments compilation = environmentFunctions : List EnvironmentFunctionEntry environmentFunctions = - compilation.environmentFunctions ++ envFunctionsFromClosureCaptures + List.concat + [ compilation.environmentFunctions, envFunctionsFromClosureCaptures ] newEmitStack = { compilation @@ -1181,8 +1193,10 @@ emitFunctionApplication functionExpression arguments compilation = envFunctionsExpr : Pine.Expression envFunctionsExpr = Pine.ListExpression - (forwardedItems - ++ appendedEnvFunctionsExpressions + (List.concat + [ forwardedItems + , appendedEnvFunctionsExpressions + ] ) in case emitExpression newEmitStack funcBody of @@ -1382,20 +1396,24 @@ emitApplyFunctionFromCurrentEnvironment compilation { functionName } arguments = case currentEnvironmentFunctionEntryFromName nextExpectedFunctionName of Nothing -> Err - ("Function '" - ++ functionName - ++ "' expects environment function '" - ++ nextExpectedFunctionName - ++ "' but it is not in the environment" + (String.join "" + [ "Function '" + , functionName + , "' expects environment function '" + , nextExpectedFunctionName + , "' but it is not in the environment" + ] ) Just ( indexInEnv, _ ) -> buildEnvironmentRecursive - (alreadyMapped - ++ [ listItemFromIndexExpression_Pine + (List.concat + [ alreadyMapped + , [ listItemFromIndexExpression_Pine indexInEnv getEnvFunctionsExpression - ] + ] + ] ) remainingExpectedFunctions @@ -1527,24 +1545,27 @@ adaptivePartialApplicationExpression : , applicationFunctionSource : Maybe Pine.Expression } -> Pine.Expression -adaptivePartialApplicationExpression { function, arguments, applicationFunctionSource } = - if arguments == [] then - function +adaptivePartialApplicationExpression config = + if config.arguments == [] then + config.function else let applicationFunctionExpr = - Maybe.withDefault - (Pine.LiteralExpression adaptivePartialApplicationRecursiveValue) - applicationFunctionSource + case config.applicationFunctionSource of + Just applicationFunctionSource -> + applicationFunctionSource + + Nothing -> + Pine.LiteralExpression adaptivePartialApplicationRecursiveValue in Pine.ParseAndEvalExpression { expression = applicationFunctionExpr , environment = Pine.ListExpression [ applicationFunctionExpr - , function - , Pine.ListExpression arguments + , config.function + , Pine.ListExpression config.arguments ] } @@ -1741,8 +1762,10 @@ parseFunctionRecordFromValueTagged value = _ -> Err - ("List does not have the expected number of items: " - ++ String.fromInt (List.length listItems) + (String.join "" + [ "List does not have the expected number of items: " + , String.fromInt (List.length listItems) + ] ) diff --git a/implement/elm-time/ElmTime/compile-elm-program/src/Pine.elm b/implement/elm-time/ElmTime/compile-elm-program/src/Pine.elm index 227d3aee..104ba378 100644 --- a/implement/elm-time/ElmTime/compile-elm-program/src/Pine.elm +++ b/implement/elm-time/ElmTime/compile-elm-program/src/Pine.elm @@ -129,7 +129,9 @@ evaluateExpression context expression = Err err -> Err (DescribePathNode - ("Failed to evaluate list item " ++ String.fromInt listElementIndex ++ ": ") + (String.join "" + [ "Failed to evaluate list item ", String.fromInt listElementIndex, ": " ] + ) err ) @@ -149,7 +151,9 @@ evaluateExpression context expression = Err error -> Err (DescribePathNode - ("Failed parse and evaluate of '" ++ describeExpression 1 parseAndEval.expression ++ "'") + (String.join "" + [ "Failed parse and evaluate of '", describeExpression 1 parseAndEval.expression, "'" ] + ) error ) @@ -161,7 +165,9 @@ evaluateExpression context expression = Err error -> Err (DescribePathNode - ("Failed to evaluate argument for kernel function " ++ application.functionName ++ ": ") + (String.join "" + [ "Failed to evaluate argument for kernel function ", application.functionName, ": " ] + ) error ) @@ -198,7 +204,13 @@ evaluateExpression context expression = in case evaluateExpression context tagged of Err err -> - Err (DescribePathNode ("Failed to evaluate tagged expression '" ++ tag ++ "': ") err) + Err + (DescribePathNode + (String.join "" + [ "Failed to evaluate tagged expression '", tag, "': " ] + ) + err + ) Ok ok -> Ok ok @@ -412,7 +424,12 @@ evaluateParseAndEval context parseAndEval = Err error -> Err (DescribePathNode - ("Failed to evaluate environment '" ++ describeExpression 1 parseAndEval.environment ++ "'") + (String.join "" + [ "Failed to evaluate environment '" + , describeExpression 1 parseAndEval.environment + , "'" + ] + ) error ) @@ -421,7 +438,12 @@ evaluateParseAndEval context parseAndEval = Err error -> Err (DescribePathNode - ("Failed to evaluate expression '" ++ describeExpression 1 parseAndEval.expression ++ "'") + (String.join "" + [ "Failed to evaluate expression '" + , describeExpression 1 parseAndEval.expression + , "'" + ] + ) error ) @@ -430,7 +452,12 @@ evaluateParseAndEval context parseAndEval = Err error -> Err (DescribePathNode - ("Failed to parse expression from value '" ++ describeValue 3 functionValue ++ "'") + (String.join "" + [ "Failed to parse expression from value '" + , describeValue 3 functionValue + , "'" + ] + ) (DescribePathEnd error) ) @@ -523,30 +550,40 @@ describeExpression : Int -> Expression -> String describeExpression depthLimit expression = case expression of ListExpression list -> - "list[" - ++ (if depthLimit < 1 then - "..." - - else - String.join "," (List.map (describeExpression (depthLimit - 1)) list) - ) - ++ "]" + String.join "" + [ "list[" + , if depthLimit < 1 then + "..." + + else + String.join "," (List.map (describeExpression (depthLimit - 1)) list) + , "]" + ] LiteralExpression literal -> - "literal(" ++ describeValue (depthLimit - 1) literal ++ ")" + String.join "" + [ "literal(" + , describeValue (depthLimit - 1) literal + , ")" + ] ParseAndEvalExpression parseAndEval -> - "parse-and-eval(" - ++ (if depthLimit < 1 then - "..." - - else - describeExpression (depthLimit - 1) parseAndEval.expression - ) - ++ ")" + String.join "" + [ "parse-and-eval(" + , if depthLimit < 1 then + "..." + + else + describeExpression (depthLimit - 1) parseAndEval.expression + , ")" + ] KernelApplicationExpression application -> - "kernel-application(" ++ application.functionName ++ ")" + String.join "" + [ "kernel-application(" + , application.functionName + , ")" + ] ConditionalExpression _ -> "conditional" @@ -555,26 +592,34 @@ describeExpression depthLimit expression = "environment" StringTagExpression tag tagged -> - "string-tag-" ++ tag ++ "(" ++ describeExpression (depthLimit - 1) tagged ++ ")" + String.join "" + [ "string-tag-" + , tag + , "(" + , describeExpression (depthLimit - 1) tagged + , ")" + ] describeValue : Int -> Value -> String describeValue maxDepth value = case value of BlobValue blob -> - "BlobValue 0x" ++ hexadecimalRepresentationFromBlobValue blob + String.join "" + [ "BlobValue 0x", hexadecimalRepresentationFromBlobValue blob ] ListValue list -> let standard = - "[" - ++ (if maxDepth < 0 then - "..." - - else - String.join ", " (List.map (describeValue (maxDepth - 1)) list) - ) - ++ "]" + String.join "" + [ "[" + , if maxDepth < 0 then + "..." + + else + String.join ", " (List.map (describeValue (maxDepth - 1)) list) + , "]" + ] in String.join " " [ "ListValue" @@ -583,7 +628,8 @@ describeValue maxDepth value = "" Ok string -> - "\"" ++ string ++ "\"" + String.join "" + [ "\"", string, "\"" ] , standard ] @@ -595,7 +641,8 @@ displayStringFromPineError error = end DescribePathNode nodeDescription node -> - nodeDescription ++ "\n" ++ prependAllLines " " (displayStringFromPineError node) + String.join "" + [ nodeDescription, "\n", prependAllLines " " (displayStringFromPineError node) ] prependAllLines : String -> String -> String @@ -734,8 +781,10 @@ stringFromListValue values = _ -> Err - ("Failed to map to char - unsupported number of bytes: " - ++ String.fromInt (List.length intValueBytes) + (String.join "" + [ "Failed to map to char - unsupported number of bytes: " + , String.fromInt (List.length intValueBytes) + ] ) _ -> @@ -743,7 +792,7 @@ stringFromListValue values = in case continueRecursive values [] of Err err -> - Err ("Failed to map list items to chars: " ++ err) + Err (String.join "" [ "Failed to map list items to chars: ", err ]) Ok chars -> Ok (String.fromList (List.reverse chars)) @@ -868,7 +917,7 @@ intFromValue value = Result.map negate (intFromUnsignedBlobValue intValueBytes) _ -> - Err ("Unexpected value for sign byte: " ++ String.fromInt sign) + Err (String.join "" [ "Unexpected value for sign byte: ", String.fromInt sign ]) intFromUnsignedBlobValue : List Int -> Result String Int @@ -897,8 +946,10 @@ intFromUnsignedBlobValue intValueBytes = _ -> Err - ("Failed to map to int - unsupported number of bytes: " - ++ String.fromInt (List.length intValueBytes) + (String.join "" + [ "Failed to map to int - unsupported number of bytes: " + , String.fromInt (List.length intValueBytes) + ] ) @@ -927,7 +978,7 @@ bigIntFromBlobValue blobValue = Ok (BigInt.negate (bigIntFromUnsignedBlobValue intValueBytes)) _ -> - Err ("Unexpected value for sign byte: " ++ String.fromInt sign) + Err (String.join "" [ "Unexpected value for sign byte: ", String.fromInt sign ]) bigIntFromUnsignedBlobValue : List Int -> BigInt.BigInt @@ -1011,12 +1062,12 @@ parseExpressionFromValue : Value -> Result String Expression parseExpressionFromValue exprValue = case parseListWithExactlyTwoElements exprValue of Err err -> - Err ("Failed to parse union: " ++ err) + Err (String.join "" [ "Failed to parse union: ", err ]) Ok ( tagNameValue, unionTagValue ) -> case stringFromValue tagNameValue of Err err -> - Err ("Failed parsing tag name: " ++ err) + Err (String.join "" [ "Failed parsing tag name: ", err ]) Ok tagName -> case tagName of @@ -1072,7 +1123,7 @@ parseExpressionFromValue exprValue = Ok (StringTagExpression tag tagged) _ -> - Err ("Unexpected expr tag: " ++ tagName) + Err (String.join "" [ "Unexpected expr tag: ", tagName ]) parseListExpression : Value -> Result String Expression @@ -1088,10 +1139,12 @@ parseListExpression value = case parseExpressionFromValue itemValue of Err itemErr -> Err - ("Failed to parse list item at index " - ++ String.fromInt (List.length aggregate) - ++ ": " - ++ itemErr + (String.join "" + [ "Failed to parse list item at index " + , String.fromInt (List.length aggregate) + , ": " + , itemErr + ] ) Ok item -> @@ -1114,7 +1167,7 @@ parseParseAndEvalExpression value = ListValue list -> case parseListOfPairs list of Err err -> - Err ("Failed to parse kernel application expression: " ++ err) + Err (String.join "" [ "Failed to parse kernel application expression: ", err ]) Ok pairs -> case @@ -1185,8 +1238,10 @@ parseKernelApplicationExpression expressionValue = of Nothing -> Err - ("Unexpected value for field 'functionName': " - ++ Result.withDefault "not a string" (stringFromValue functionNameValue) + (String.join "" + [ "Unexpected value for field 'functionName': " + , Result.withDefault "not a string" (stringFromValue functionNameValue) + ] ) Just ( functionName, _ ) -> @@ -1203,7 +1258,10 @@ parseKernelApplicationExpression expressionValue = Just ( _, argumentValue ) -> case parseExpressionFromValue argumentValue of Err error -> - Err ("Failed to parse field 'argument': " ++ error) + Err + (String.join "" + [ "Failed to parse field 'argument': ", error ] + ) Ok argument -> Ok @@ -1217,12 +1275,14 @@ parseKernelFunctionFromName functionName = case Dict.get functionName kernelFunctions of Nothing -> Err - ("Did not find kernel function '" - ++ functionName - ++ "'. There are " - ++ String.fromInt (Dict.size kernelFunctions) - ++ " kernel functions available: " - ++ String.join ", " (Dict.keys kernelFunctions) + (String.join "" + [ "Did not find kernel function '" + , functionName + , "'. There are " + , String.fromInt (Dict.size kernelFunctions) + , " kernel functions available: " + , String.join ", " (Dict.keys kernelFunctions) + ] ) Just kernelFunction -> @@ -1238,7 +1298,7 @@ parseConditionalExpression expressionValue = ListValue list -> case parseListOfPairs list of Err err -> - Err ("Failed to parse kernel application expression: " ++ err) + Err (String.join "" [ "Failed to parse kernel application expression: ", err ]) Ok pairs -> case diff --git a/implement/elm-time/Program.cs b/implement/elm-time/Program.cs index 2c1b2cae..d85c3c88 100644 --- a/implement/elm-time/Program.cs +++ b/implement/elm-time/Program.cs @@ -18,7 +18,7 @@ namespace ElmTime; public class Program { - public static string AppVersionId => "0.1.4"; + public static string AppVersionId => "0.1.5"; private static int AdminInterfaceDefaultPort => 4000; diff --git a/implement/elm-time/elm-time.csproj b/implement/elm-time/elm-time.csproj index d0976b07..c55409eb 100644 --- a/implement/elm-time/elm-time.csproj +++ b/implement/elm-time/elm-time.csproj @@ -5,8 +5,8 @@ net8.0 ElmTime elm-time - 0.1.4 - 0.1.4 + 0.1.5 + 0.1.5 enable true