Skip to content

Instantly share code, notes, and snippets.

@blast-hardcheese
Created November 6, 2018 06:54
Show Gist options
  • Save blast-hardcheese/a4e790425716427c8227bbf35f6da8d0 to your computer and use it in GitHub Desktop.
Save blast-hardcheese/a4e790425716427c8227bbf35f6da8d0 to your computer and use it in GitHub Desktop.
Pathed types
> compile
[info] Compiling 1 Scala source to /Users/dstewart/Projects/guardrail/modules/codegen/target/scala-2.12/classes...
[error] /Users/dstewart/Projects/guardrail/modules/codegen/src/main/scala/com/twilio/guardrail/CLI.scala:17: type mismatch;
[error] found : CLICommon.algebra.CoreTerms
[error] required: CLICommon.common.A.CoreTerms
[error] common.runM(algebra.coreTerm)
[error] ^
[error] one error found
[error] (codegen/compile:compileIncremental) Compilation failed
[error] Total time: 0 s, completed Nov 5, 2018 10:53:10 PM
trait CoreAlgebra {
class CoreTerms
def coreTerm: CoreTerms =
new CoreTerms
}
class Common(final val A: CoreAlgebra) {
def runM(C: A.CoreTerms): String = ???
}
object CLICommon {
val algebra = new CoreAlgebra {}
val common = new Common(algebra)
def run: Unit =
common.runM(algebra.coreTerm)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment