Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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