Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to embed Ammonite-REPL in Scala 3? #1250

Closed
vaclavsvejcar opened this issue Feb 3, 2022 · 3 comments · Fixed by #1383
Closed

How to embed Ammonite-REPL in Scala 3? #1250

vaclavsvejcar opened this issue Feb 3, 2022 · 3 comments · Fixed by #1383

Comments

@vaclavsvejcar
Copy link

I used embedded Ammonite-REPL with Scala 2.x successfully, but after migrating to Scala 3 I'm having trouble to compile the code using the guide from documentation:

ThisBuild / scalaVersion := "3.1.1"
...
libraryDependencies += "com.lihaoyi" % "ammonite" % "2.5.2" cross CrossVersion.full

Then in code

ammonite.Main(predefCode = code).run("ast" -> ast, "defs" -> defs, "json" -> json)

and I'm getting compile error:

[error] 45 |      ammonite.Main(predefCode = code).run("ast" -> ast, "defs" -> defs, "json" -> json)
[error]    |                                           ^^^^^^^^^^^^
[error]    |                          Found:    (String, dev.svejcar.sjq.model.Node)
[error]    |                          Required: ammonite.util.Bind[?]

It looks that Scala 3 doesn't like either the implicit conversion in ammonite.util.Bind#ammoniteReplArrowBinder or how it uses the TypeTag stuff (which AFAIK is not in Scala 3).

My question is, is Ammonite-REPL supposed to work embedded from Scala 3 code and if yes, what should I do to make it work?

@edwardcwang
Copy link

It's possible to work around the arrow binder issue but then we get stuck with "No TypeTag available for Int".

ammonite.Main().run(ammonite.util.Bind("myInt", 1234))

@lolgab
Copy link
Member

lolgab commented Nov 17, 2023

This is fixed in 3.0.0-M0-59-cdeaa580

@edwardcwang
Copy link

Confirmed working in 3.0.0-M0-59-cdeaa580 and Scala 3.3.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants