Skip to content

Instantly share code, notes, and snippets.

@sir-wabbit
Last active August 25, 2016 21:02
Show Gist options
  • Select an option

  • Save sir-wabbit/2165615e5c50d17d2c1b6ef5cc57330b to your computer and use it in GitHub Desktop.

Select an option

Save sir-wabbit/2165615e5c50d17d2c1b6ef5cc57330b to your computer and use it in GitHub Desktop.
trait P1[T]
final class C1(x: Int) extends P1[Int]
val v = (C1(1): P1[]
trait P2[T, U]
final class C2_3[A, B](x: A, y: B) extends P2[A, B]
final class C2_2[A, B](x: A, y: B) extends P2[B, A]
final class C2_1[A](x: A) extends P2[A, A]

Better for notation (ignore results)

for {
  do()
  ...
} ...
for {
  _ <- do()
  ...
} ...

SI-907: Better for notation (val declarations)

for {
  m = ...
  a <- do()
  ...
} ...
{
  val m = ...
  for {
    a <- do()
    ...
  } ...
}

Better for notation (yield from)

for {
  ...
} yield from do()
for {
  ...
  a <- do()
} yield a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment