identity = \a -> a
compose = \fnA, fnB ->
\a -> fnB (fnA a)
chain = \fns ->
List.walk fns identity compose
main =
values = List.map [1,2,3] (chain [(\a -> a * 2), (\b -> b + 1)])
Stdout.line "hi"
Using compose instead of chain avoids the error. Not using it on a List.map avoids the error.
Result
thread 'main' panicked at 'Error in alias analysis: error in module ModName("UserApp"), function definition FuncName("\x07\x00\x00\x00\x05\x00\x00\x00G\xba\x93XR\xc7\xa9C"), definition of value binding ValueId(14): expected type '((),)', found type '((), "UserApp"::"Z\x8d\xb3\xec5\xdf\xb7\xf9")'', crates/compiler/gen_llvm/src/llvm/build.rs:5624:19
In REPL
When using the repl, a smaller reproduction also gives a different error:
compose = \fnA, fnB ->
\a -> fnB (fnA a)
List.map [1,2,3] (compose (\a -> a * 2) (\b -> b + 1))
Gives:
panicked at 'called Option::unwrap() on a None value', crates/compiler/gen_wasm/src/backend.rs:2131:14
Edit:
Calling the function explicitly also solves it, so it might be related to anonymous functions. Here is a minimal fix on the original:
- values = List.map [1,2,3] (chain [(\a -> a * 2), (\b -> b + 1)])
+ values = List.map [1,2,3] \x -> (chain [(\a -> a * 2), (\b -> b + 1)]) x
Hi,
This is probably related with #851.
Setup
This is a minimal repro:
Using compose instead of chain avoids the error. Not using it on a List.map avoids the error.
Result
In REPL
When using the repl, a smaller reproduction also gives a different error:
Gives:
Edit:
Calling the function explicitly also solves it, so it might be related to anonymous functions. Here is a minimal fix on the original: