Last active
February 15, 2020 17:15
-
-
Save choplin/79d0fddbb6c0da9f2121f43c6796c473 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mill._, scalalib._ | |
object example extends ScalaModule { | |
def scalaVersion = "2.13.1" | |
def ivyDeps = Agg[Dep]( | |
ivy"org.wvlet.airframe::airframe:20.2.0" | |
) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
❯ ./mill example.run | |
[27/37] example.compile | |
[info] Compiling 1 Scala source to /home/okuno/study/scala/airframe/out/example/compile/dest/classes ... | |
[error] /home/okuno/study/scala/airframe/example/src/Service.scala:6:17: illegal inheritance from sealed trait Adt | |
[error] val adt = bind[Adt] | |
[error] ^ | |
[error] one error found | |
1 targets failed | |
example.compile Compilation failed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example | |
import wvlet.airframe._ | |
sealed trait Adt | |
object Adt { | |
object Foo extends Adt | |
object Bar extends Adt | |
} | |
object Main extends App { | |
val design = Design.newDesign.bind[Adt].toInstance(Adt.Foo) | |
design.build[Adt](adt => println(adt)) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example | |
import wvlet.airframe._ | |
// Does not compile | |
// trait Service { | |
// val adt = bind[Adt] | |
//} | |
// ok | |
class Service (adt: Adt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment