Describe the bugmorphir-elm make will report value cycles when none exist.
To Reproduce
The following code compiles in native elm but not in morphir-elm:
countA : Int -> Int
countA x =
if x == 0
then 0
else x + countB (x-1)
countB : Int -> Int
countB x =
if x == 0
then 0
else x + countA (x-1)
The following example demonstrates the same issue, but better isolates that it is specifically mutually recursive functions that cause this issue:
type IntCons =
Nil
| HeadTail Int IntCons
sum : IntCons -> Int
sum c =
case c of
Nil -> 0
HeadTail i tail -> i + redirect tail
redirect : IntCons -> Int
redirect x = sum x
Note that without the `redirect` function this is accepted.
Expected behavior
As this is not a true value cycle, the compiler should not reject it.
Desktop (please complete the following information):
OS: OSX
Version: 2.89.0
Additional context
While the example above is pointless, this is causing us an actual issue where we need a "dispatch" function that may send certain variants of a recursive type to particular handlers based on what else exists in the tree.
Describe the bug
morphir-elm make
will report value cycles when none exist.To Reproduce The following code compiles in native elm but not in morphir-elm:
The following example demonstrates the same issue, but better isolates that it is specifically mutually recursive functions that cause this issue:
Expected behavior As this is not a true value cycle, the compiler should not reject it.
Desktop (please complete the following information):
Additional context While the example above is pointless, this is causing us an actual issue where we need a "dispatch" function that may send certain variants of a recursive type to particular handlers based on what else exists in the tree.