Created
February 8, 2013 13:16
-
-
Save jeantil/4738988 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 org.specs2.mutable._ | |
class ImplicitiSpec extends Specification { | |
type Store=Map[String,String] | |
object Value { | |
def apply(k:String)(implicit map:Store):String={ | |
println(s"reads value for ${k}") | |
map.get(k).getOrElse("") | |
} | |
} | |
trait A { | |
lazy val a:String= ??? // Value("a") ... | |
} | |
object B extends A | |
"An Implicit" should { | |
"be propagated " in{ | |
// If I knew how to code properly this would compile and work | |
implicit val m=Map("a"->"aa") | |
B.a === "aa" | |
} | |
} | |
} |
implicit def
I don't get it :( I'll submit it to the psug
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't know how to implement trait A
The goal is :