Bend/tests/snapshots/compile_file_o_no_all__list_reverse.bend.snap
2024-05-25 19:03:13 +02:00

33 lines
1.5 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
source: tests/golden_tests.rs
input_file: tests/golden_tests/compile_file_o_no_all/list_reverse.bend
---
Errors:
The following functions contain recursive cycles incompatible with HVM's strict evaluation:
* concat -> concat
* reverse -> reverse
The greedy eager evaluation of HVM may cause infinite loops.
Refactor these functions to use lazy references instead of direct function calls.
A reference is strict when it's being called ('(Foo x)') or when it's used non-linearly ('let x = Foo; (x x)').
It is lazy when it's an argument ('(x Foo)') or when it's used linearly ('let x = Foo; (x 0)').
Try one of these strategies:
- Use pattern matching with 'match', 'fold', and 'bend' to automatically lift expressions to lazy references.
- Replace direct calls with combinators. For example, change:
'Foo = λa λb (b (λc (Foo a c)) a)'
to:
'Foo = λa λb (b (λc λa (Foo a c)) (λa a) a)'
which is lifted to:
'Foo = λa λb (b Foo__C1 Foo__C2 a)'
- Replace non-linear 'let' expressions with 'use' expressions. For example, change:
'Foo = λf let x = Foo; (f x x)'
to:
'Foo = λf use x = Foo; (f x x)'
which inlines to:
'Foo = λf (f Foo Foo)'
- If disabled, re-enable the default 'float-combinators' and 'linearize-matches' compiler options.
For more information, visit: https://github.com/HigherOrderCO/Bend/blob/main/docs/lazy-definitions.md.
To disable this check, use the "-Arecursion-cycle" compiler option.