Created
July 15, 2017 18:46
-
-
Save kubukoz/397e049325dc9793ee79d6572a8c9494 to your computer and use it in GitHub Desktop.
This file contains 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
object ChainedConversions { | |
implicit def chain[A, B, C](implicit ab: A => B, bc: B => C): A => C = ab andThen bc | |
implicit val intToString: Int => String = _.toString | |
class X | |
implicit val stringToX: String => X = _ => new X | |
val a: X = 5 // idea marks it as a proper conversion | |
//doesn't compile though | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment