From e90644d706fd7b4a248d03ffb89d8e6a0fa39609 Mon Sep 17 00:00:00 2001 From: imaqtkatt Date: Thu, 21 Mar 2024 20:13:26 -0300 Subject: [PATCH] Update mutual recursion error message --- src/hvmc_net/mutual_recursion.message | 8 ++++++-- .../compile_file_o_all__repeated_name_trucation.hvm.snap | 8 ++++++-- tests/snapshots/mutual_recursion__a_b_c.hvm.snap | 8 ++++++-- tests/snapshots/mutual_recursion__multiple.hvm.snap | 8 ++++++-- tests/snapshots/mutual_recursion__odd_even.hvm.snap | 8 ++++++-- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/hvmc_net/mutual_recursion.message b/src/hvmc_net/mutual_recursion.message index 9a02a3034..e4b62c935 100644 --- a/src/hvmc_net/mutual_recursion.message +++ b/src/hvmc_net/mutual_recursion.message @@ -2,6 +2,7 @@ Seems like you're trying to run some recursive function(s) on strict-mode: {refs} Due to the ultra-greedy nature of strict-mode, that might result in infinite loops. +If the float-combinators optimization is not on, we recommend activating it. You have 2 options: @@ -9,6 +10,9 @@ You have 2 options: Just append the `-L` option to `HVM-Lang`, and it will run in lazy-mode. It has the advantage of not doing wasteful work, having an improved complexity class, and being compatible with unrestricted recursion! It has a small overhead though, and isn't compatible with GPU. -2. Hard Fix: use combinators. +2. Hard Fix: refactor the program to use lazy references. -By converting your program to use combinators, you can avoid the direct recursive calls that result in loops. If you use the built-in `data` and `match` syntaxes, HVM-Lang usually does this for you, but it couldn't handle your program. See here for more info: https://github.com/HigherOrderCO/hvm-lang/blob/main/docs/lazy-definitions.md. +When a function reference is in head position of an application or is duplicated by the non-linear use of a `let` expression it will be greedly expanded, leading to an infinite loop. +If the application is used written as a combinator, it will automatically lifted to a lazy reference, which usually breaks the recursion cycle. Alternatively, by using the built-in `data` and `match` syntax, hvm-lang will try to do this automatically. +For let expressions where the variable is non-linear (used more than once), you can instead employ `use` expressions to statically duplicate the offending recursive term. +See here for more info: https://github.com/HigherOrderCO/hvm-lang/blob/main/docs/lazy-definitions.md. diff --git a/tests/snapshots/compile_file_o_all__repeated_name_trucation.hvm.snap b/tests/snapshots/compile_file_o_all__repeated_name_trucation.hvm.snap index c923500ae..252c45ea1 100644 --- a/tests/snapshots/compile_file_o_all__repeated_name_trucation.hvm.snap +++ b/tests/snapshots/compile_file_o_all__repeated_name_trucation.hvm.snap @@ -8,6 +8,7 @@ long_name_that_truncates long_name_that_truncates$C0 Due to the ultra-greedy nature of strict-mode, that might result in infinite loops. +If the float-combinators optimization is not on, we recommend activating it. You have 2 options: @@ -15,9 +16,12 @@ You have 2 options: Just append the `-L` option to `HVM-Lang`, and it will run in lazy-mode. It has the advantage of not doing wasteful work, having an improved complexity class, and being compatible with unrestricted recursion! It has a small overhead though, and isn't compatible with GPU. -2. Hard Fix: use combinators. +2. Hard Fix: refactor the program to use lazy references. -By converting your program to use combinators, you can avoid the direct recursive calls that result in loops. If you use the built-in `data` and `match` syntaxes, HVM-Lang usually does this for you, but it couldn't handle your program. See here for more info: https://github.com/HigherOrderCO/hvm-lang/blob/main/docs/lazy-definitions.md. +When a function reference is in head position of an application or is duplicated by the non-linear use of a `let` expression it will be greedly expanded, leading to an infinite loop. +If the application is used written as a combinator, it will automatically lifted to a lazy reference, which usually breaks the recursion cycle. Alternatively, by using the built-in `data` and `match` syntax, hvm-lang will try to do this automatically. +For let expressions where the variable is non-linear (used more than once), you can instead employ `use` expressions to statically duplicate the offending recursive term. +See here for more info: https://github.com/HigherOrderCO/hvm-lang/blob/main/docs/lazy-definitions.md. @long_name_that_truncates = (* @long_name_that_truncates$C0) diff --git a/tests/snapshots/mutual_recursion__a_b_c.hvm.snap b/tests/snapshots/mutual_recursion__a_b_c.hvm.snap index d425048ea..406fe9519 100644 --- a/tests/snapshots/mutual_recursion__a_b_c.hvm.snap +++ b/tests/snapshots/mutual_recursion__a_b_c.hvm.snap @@ -9,6 +9,7 @@ B C Due to the ultra-greedy nature of strict-mode, that might result in infinite loops. +If the float-combinators optimization is not on, we recommend activating it. You have 2 options: @@ -16,6 +17,9 @@ You have 2 options: Just append the `-L` option to `HVM-Lang`, and it will run in lazy-mode. It has the advantage of not doing wasteful work, having an improved complexity class, and being compatible with unrestricted recursion! It has a small overhead though, and isn't compatible with GPU. -2. Hard Fix: use combinators. +2. Hard Fix: refactor the program to use lazy references. -By converting your program to use combinators, you can avoid the direct recursive calls that result in loops. If you use the built-in `data` and `match` syntaxes, HVM-Lang usually does this for you, but it couldn't handle your program. See here for more info: https://github.com/HigherOrderCO/hvm-lang/blob/main/docs/lazy-definitions.md. +When a function reference is in head position of an application or is duplicated by the non-linear use of a `let` expression it will be greedly expanded, leading to an infinite loop. +If the application is used written as a combinator, it will automatically lifted to a lazy reference, which usually breaks the recursion cycle. Alternatively, by using the built-in `data` and `match` syntax, hvm-lang will try to do this automatically. +For let expressions where the variable is non-linear (used more than once), you can instead employ `use` expressions to statically duplicate the offending recursive term. +See here for more info: https://github.com/HigherOrderCO/hvm-lang/blob/main/docs/lazy-definitions.md. diff --git a/tests/snapshots/mutual_recursion__multiple.hvm.snap b/tests/snapshots/mutual_recursion__multiple.hvm.snap index 4c350b117..8f48533aa 100644 --- a/tests/snapshots/mutual_recursion__multiple.hvm.snap +++ b/tests/snapshots/mutual_recursion__multiple.hvm.snap @@ -12,6 +12,7 @@ I ... Due to the ultra-greedy nature of strict-mode, that might result in infinite loops. +If the float-combinators optimization is not on, we recommend activating it. You have 2 options: @@ -19,6 +20,9 @@ You have 2 options: Just append the `-L` option to `HVM-Lang`, and it will run in lazy-mode. It has the advantage of not doing wasteful work, having an improved complexity class, and being compatible with unrestricted recursion! It has a small overhead though, and isn't compatible with GPU. -2. Hard Fix: use combinators. +2. Hard Fix: refactor the program to use lazy references. -By converting your program to use combinators, you can avoid the direct recursive calls that result in loops. If you use the built-in `data` and `match` syntaxes, HVM-Lang usually does this for you, but it couldn't handle your program. See here for more info: https://github.com/HigherOrderCO/hvm-lang/blob/main/docs/lazy-definitions.md. +When a function reference is in head position of an application or is duplicated by the non-linear use of a `let` expression it will be greedly expanded, leading to an infinite loop. +If the application is used written as a combinator, it will automatically lifted to a lazy reference, which usually breaks the recursion cycle. Alternatively, by using the built-in `data` and `match` syntax, hvm-lang will try to do this automatically. +For let expressions where the variable is non-linear (used more than once), you can instead employ `use` expressions to statically duplicate the offending recursive term. +See here for more info: https://github.com/HigherOrderCO/hvm-lang/blob/main/docs/lazy-definitions.md. diff --git a/tests/snapshots/mutual_recursion__odd_even.hvm.snap b/tests/snapshots/mutual_recursion__odd_even.hvm.snap index 79eaf3908..ba0b2bce4 100644 --- a/tests/snapshots/mutual_recursion__odd_even.hvm.snap +++ b/tests/snapshots/mutual_recursion__odd_even.hvm.snap @@ -8,6 +8,7 @@ isEven isOdd Due to the ultra-greedy nature of strict-mode, that might result in infinite loops. +If the float-combinators optimization is not on, we recommend activating it. You have 2 options: @@ -15,6 +16,9 @@ You have 2 options: Just append the `-L` option to `HVM-Lang`, and it will run in lazy-mode. It has the advantage of not doing wasteful work, having an improved complexity class, and being compatible with unrestricted recursion! It has a small overhead though, and isn't compatible with GPU. -2. Hard Fix: use combinators. +2. Hard Fix: refactor the program to use lazy references. -By converting your program to use combinators, you can avoid the direct recursive calls that result in loops. If you use the built-in `data` and `match` syntaxes, HVM-Lang usually does this for you, but it couldn't handle your program. See here for more info: https://github.com/HigherOrderCO/hvm-lang/blob/main/docs/lazy-definitions.md. +When a function reference is in head position of an application or is duplicated by the non-linear use of a `let` expression it will be greedly expanded, leading to an infinite loop. +If the application is used written as a combinator, it will automatically lifted to a lazy reference, which usually breaks the recursion cycle. Alternatively, by using the built-in `data` and `match` syntax, hvm-lang will try to do this automatically. +For let expressions where the variable is non-linear (used more than once), you can instead employ `use` expressions to statically duplicate the offending recursive term. +See here for more info: https://github.com/HigherOrderCO/hvm-lang/blob/main/docs/lazy-definitions.md.