Open jiribenes opened 4 months ago
the REPL always runs with the JavaScript backend:
For debugging I often use different backends in the REPL, e.g. via effekt.sh --backend llvm
Am I misunderstanding this?
Thanks, I took a closer look and invalidated my assumption. The REPL runs for any backend... I'll fix it in the original issue description.
Problem
When I put an expression into the REPL, the REPL tries to call
println($EXPR)
which fails for all non-trivial types since #449:Full error
``` Possible overload: option::println of type Option[Double] => Unit Argument count does not match TrafficLight2360 vs. Option593 Expected type Option[Double] but got type TrafficLight Possible overload: effekt::println of type String => Unit Expected String but got TrafficLight. Possible overload: effekt::println of type Int => Unit Expected Int but got TrafficLight. Possible overload: array::println of type Array[String] => Unit Argument count does not match TrafficLight2360 vs. Array1667 Expected type Array[String] but got type TrafficLight Possible overload: option::println of type Option[Bool] => Unit Argument count does not match TrafficLight2360 vs. Option593 Expected Option[Bool] but got TrafficLight. Possible overload: list::println of type List[Int] => Unit Argument count does not match TrafficLight2360 vs. List767 Expected List[Int] but got TrafficLight. Possible overload: option::println of type Option[Int] => Unit Argument count does not match TrafficLight2360 vs. Option593 Expected Option[Int] but got TrafficLight. Possible overload: list::println of type List[Double] => Unit Argument count does not match TrafficLight2360 vs. List767 Expected List[Double] but got TrafficLight. Possible overload: effekt::println of type Unit => Unit Expected Unit but got TrafficLight. Possible overload: list::println of type List[String] => Unit Argument count does not match TrafficLight2360 vs. List767 Expected List[String] but got TrafficLight. Possible overload: array::println of type Array[Bool] => Unit Argument count does not match TrafficLight2360 vs. Array1667 Expected Array[Bool] but got TrafficLight. Possible overload: effekt::println of type Double => Unit Expected Double but got TrafficLight. Possible overload: array::println of type Array[Double] => Unit Argument count does not match TrafficLight2360 vs. Array1667 Expected type Array[Double] but got type TrafficLight Possible overload: list::println of type List[Bool] => Unit Argument count does not match TrafficLight2360 vs. List767 Expected List[Bool] but got TrafficLight. Possible overload: effekt::println of type Ordering => Unit Expected Ordering but got TrafficLight. Possible overload: effekt::println of type Bool => Unit Expected Bool but got TrafficLight. Possible overload: array::println of type Array[Int] => Unit Argument count does not match TrafficLight2360 vs. Array1667 Expected Array[Int] but got TrafficLight. ```Source
Here's the code in question which just calls
println
on terms: https://github.com/effekt-lang/effekt/blob/aa897e4f70407d5086d0da093ce04824bf43acee/effekt/jvm/src/main/scala/effekt/Repl.scala#L318-L319Potential solution
If we don't want to wait for typeclasses #66, we could instead use
inspect
introduced in #449 because the REPLalways runs with the JavaScript backend: EDIT: Not true, the REPL runs with the backend of user's choice, see below. The workaround would only work for the JS and Chez backends https://github.com/effekt-lang/effekt/blob/aa897e4f70407d5086d0da093ce04824bf43acee/libraries/common/effekt.effekt#L102-L104