Skip to content

Compiler plugins in REPL #2907

Open
Open
@rossabaker

Description

@rossabaker

Is your feature request related to a problem? Please describe.

I'm trying to use kind-projector in a REPL. It downloads, but does not seem to take effect.

$ scala-cli repl --compiler-plugin org.typelevel:::kind-projector:0.13.3 --scala 2.13.14 --dep org.typelevel::cats-core:2.10.0
Welcome to Scala 2.13.14 (OpenJDK 64-Bit Server VM, Java 17.0.10).
Type in expressions for evaluation. Or try :help.

scala> cats.Functor[Either[String, *]]
                                   ^
       error: not found: type *
                    ^
       error: Either[String,<error>] takes no type parameters, expected: 1

Describe the solution you'd like

I would like compiler plugins to work inside the repl. The above example should find the instance.

Describe alternatives you've considered

Print a warning or fail with an error if compiler plugins are provided to a REPL that can't honor them.

Additional context

Compiler plugins appear to be honored outside the repl:

$ echo 'println(cats.Functor[Either[String,*]])' | scala-cli run --compiler-plugin org.typelevel:::kind-projector:0.13.3 --scala 2.13.14 --dep org.typelevel::cats-core:2.10.0 -
Compiling project (Scala 2.13.14, JVM (17))
Compiled project (Scala 2.13.14, JVM (17))
cats.instances.EitherInstances$$anon$2@6276ae34

Metadata

Metadata

Assignees

No one assigned

    Labels

    REPLIssues tied with the repl sub-command.enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions