diff --git a/cli/gen-package/codegen/Gen/Elm/Declare.elm b/cli/gen-package/codegen/Gen/Elm/Declare.elm index 873114d1..7ae3fd3b 100644 --- a/cli/gen-package/codegen/Gen/Elm/Declare.elm +++ b/cli/gen-package/codegen/Gen/Elm/Declare.elm @@ -26,7 +26,7 @@ fn : -> Elm.Expression -> (Elm.Expression -> Elm.Expression) -> Elm.Expression -fn fnArg fnArg0 fnArg1 = +fn fn_Arg fn_Arg0 fn_Arg1 = Elm.apply (Elm.value { importFrom = [ "Elm", "Declare" ] @@ -54,7 +54,7 @@ fn fnArg fnArg0 fnArg1 = ) } ) - [ Elm.string fnArg, fnArg0, Elm.functionReduced "fnUnpack" fnArg1 ] + [ Elm.string fn_Arg, fn_Arg0, Elm.functionReduced "fnUnpack" fn_Arg1 ] {-| fn2: @@ -1340,7 +1340,7 @@ call_ : } call_ = { fn = - \fnArg fnArg0 fnArg1 -> + \fn_Arg fn_Arg0 fn_Arg1 -> Elm.apply (Elm.value { importFrom = [ "Elm", "Declare" ] @@ -1376,7 +1376,7 @@ call_ = ) } ) - [ fnArg, fnArg0, fnArg1 ] + [ fn_Arg, fn_Arg0, fn_Arg1 ] , fn2 = \fn2Arg fn2Arg0 fn2Arg1 fn2Arg2 -> Elm.apply diff --git a/cli/gen-package/codegen/Gen/Elm/Let.elm b/cli/gen-package/codegen/Gen/Elm/Let.elm index 484573fa..6f128efb 100644 --- a/cli/gen-package/codegen/Gen/Elm/Let.elm +++ b/cli/gen-package/codegen/Gen/Elm/Let.elm @@ -155,7 +155,7 @@ fn : -> (Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression -fn fnArg fnArg0 fnArg1 fnArg2 = +fn fn_Arg fn_Arg0 fn_Arg1 fn_Arg2 = Elm.apply (Elm.value { importFrom = [ "Elm", "Let" ] @@ -203,10 +203,10 @@ fn fnArg fnArg0 fnArg1 fnArg2 = ) } ) - [ Elm.string fnArg - , fnArg0 - , Elm.functionReduced "fnUnpack" fnArg1 - , fnArg2 + [ Elm.string fn_Arg + , fn_Arg0 + , Elm.functionReduced "fnUnpack" fn_Arg1 + , fn_Arg2 ] @@ -622,7 +622,7 @@ call_ = ) [ recordArg, recordArg0, recordArg1 ] , fn = - \fnArg fnArg0 fnArg1 fnArg2 -> + \fn_Arg fn_Arg0 fn_Arg1 fn_Arg2 -> Elm.apply (Elm.value { importFrom = [ "Elm", "Let" ] @@ -671,7 +671,7 @@ call_ = ) } ) - [ fnArg, fnArg0, fnArg1, fnArg2 ] + [ fn_Arg, fn_Arg0, fn_Arg1, fn_Arg2 ] , fn2 = \fn2Arg fn2Arg0 fn2Arg1 fn2Arg2 fn2Arg3 -> Elm.apply diff --git a/cli/gen-package/src/Generate.elm b/cli/gen-package/src/Generate.elm index 7e4f3664..20bf50ab 100644 --- a/cli/gen-package/src/Generate.elm +++ b/cli/gen-package/src/Generate.elm @@ -416,7 +416,7 @@ block2Maker thisModule block = ) |> Gen.Elm.record in - Elm.fn (Elm.Arg.varWith (name ++ "_Arg") lambdaArgType) lambdaValue + Elm.fn (Elm.Arg.varWith (toArgName name) lambdaArgType) lambdaValue |> Just _ -> @@ -534,7 +534,7 @@ annotationNamed thisModule name tags = Elm.function (List.indexedMap (\i arg -> - ( name ++ "_Arg" ++ String.fromInt i + ( toArgName name ++ String.fromInt i , Just (Annotation.named elmAnnotation "Annotation") ) ) @@ -630,7 +630,7 @@ aliasNamed docAlias = Elm.function (List.indexedMap (\i arg -> - ( docAlias.name ++ "_Arg" ++ String.fromInt i + ( toArgName docAlias.name ++ String.fromInt i , Just (Annotation.named elmAnnotation "Annotation") ) ) @@ -884,7 +884,7 @@ captureFunction baseName tipe captured = in captureFunction baseName two - { arguments = ( baseName ++ "_Arg", Just unpacked.annotation ) :: captured.arguments + { arguments = ( toArgName baseName, Just unpacked.annotation ) :: captured.arguments , unpackers = unpacked.unpacker :: captured.unpackers } @@ -893,11 +893,20 @@ captureFunction baseName tipe captured = unpacked = unpackArg baseName tipe in - { arguments = ( baseName ++ "_Arg", Just unpacked.annotation ) :: captured.arguments + { arguments = ( toArgName baseName, Just unpacked.annotation ) :: captured.arguments , unpackers = unpacked.unpacker :: captured.unpackers } +toArgName : String -> String +toArgName baseName = + if baseName == "fn" then + "fn_Arg" + + else + baseName ++ "Arg" + + unpackArgForLambdas : String -> Elm.Type.Type