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

Code with traits does not work - missing implicits #107

Open
zygm0nt opened this issue Feb 28, 2019 · 1 comment
Open

Code with traits does not work - missing implicits #107

zygm0nt opened this issue Feb 28, 2019 · 1 comment

Comments

@zygm0nt
Copy link

zygm0nt commented Feb 28, 2019

Hi

I'm trying to abstract over parsing arguments and preparing general class skeleton, but this code does not compile and it shows implicits missing:

import caseapp._
import caseapp.core.help.Help

case class Arguments(foo: Int, bar: String)

object MyApp extends AbstractApp[Arguments] {
  run[Arguments]()
}

trait AbstractApp[T] extends App {
  def run[T: Parser: Help]() = {
    val parsedArgs = CaseApp.parse[T](args)
    println(parsedArgs)
  }
}

How can I make this work?

Also where does those implicits come from when used in just a single file?

@cornerman
Copy link

@zygm0nt I tried out your code snippet and it compiles for me. Maybe there is another compile error somewhere else in the code?

Have you looked at the abstract class CaseApp? You can extend it for your class skeleton: MyApp extends CaseApp[Arguments].

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

No branches or pull requests

2 participants