Skip to content

Instantly share code, notes, and snippets.

@paulp
Created July 5, 2016 14:36
Show Gist options
  • Select an option

  • Save paulp/c778b7bc6b2d46a9bbe6831e4fbf6f19 to your computer and use it in GitHub Desktop.

Select an option

Save paulp/c778b7bc6b2d46a9bbe6831e4fbf6f19 to your computer and use it in GitHub Desktop.
final case class Foo(a: Int, b: Int)
class A {
def g1: List[Foo] = Nil
def f1 = for (x <- g1 ; Foo(a, b) = x) yield a + b
def f2 = for (x <- g1) yield { val Foo(a, b) = x ; a + b }
}
// def f1: List[Int] = A.this.g1.map[(Foo, Foo), List[(Foo, Foo)]](((x: Foo) => {
// <synthetic> <artifact> private[this] val x$2: (Foo, Int, Int) = {
// case <synthetic> val x1: Foo = (x: Foo @unchecked);
// case4(){
// if (x1.ne(null))
// matchEnd3(scala.Tuple3.apply[Foo, Int, Int](x1, x1.a, x1.b))
// else
// case5()
// };
// case5(){
// matchEnd3(throw new MatchError(x1))
// };
// matchEnd3(x: (Foo, Int, Int)){
// x
// }
// };
// val x$1: Foo = x$2._1;
// val a: Int = x$2._2;
// val b: Int = x$2._3;
// scala.Tuple2.apply[Foo, Foo](x, x$1)
// }))(immutable.this.List.canBuildFrom[(Foo, Foo)]).map[Int, List[Int]](((x$3: (Foo, Foo)) => {
// case <synthetic> val x1: (Foo, Foo) = (x$3: (Foo, Foo) @unchecked);
// case5(){
// if (x1.ne(null).&&(x1._2.ne(null)))
// matchEnd4(x1._2.a.+(x1._2.b))
// else
// case6()
// };
// case6(){
// matchEnd4(throw new MatchError(x1))
// };
// matchEnd4(x: Int){
// x
// }
// }))(immutable.this.List.canBuildFrom[Int]);
/*************/
// def f2: List[Int] = A.this.g1.map[Int, List[Int]](((x: Foo) => {
// <synthetic> <artifact> private[this] val x$4: (Int, Int) = {
// case <synthetic> val x1: Foo = (x: Foo @unchecked);
// case4(){
// if (x1.ne(null))
// matchEnd3(scala.Tuple2.apply[Int, Int](x1.a, x1.b))
// else
// case5()
// };
// case5(){
// matchEnd3(throw new MatchError(x1))
// };
// matchEnd3(x: (Int, Int)){
// x
// }
// };
// val a: Int = x$4._1;
// val b: Int = x$4._2;
// a.+(b)
// }))(immutable.this.List.canBuildFrom[Int])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment