Skip to content

Instantly share code, notes, and snippets.

@yllan
Created May 24, 2013 04:48
Show Gist options
  • Select an option

  • Save yllan/5641325 to your computer and use it in GitHub Desktop.

Select an option

Save yllan/5641325 to your computer and use it in GitHub Desktop.
List(1,2,3).flatMap(List(2))
// <console>:8: error: type mismatch;
// found : List[Int]
// required: Int => scala.collection.GenTraversableOnce[?]
// List(1,2,3).flatMap(List(2))
implicit def f[A, B](b: B) = (x:A) ⇒ b
List(1,2,3).flatMap(List(2))
// List[Int] = List(2, 2, 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment