diff options
author | Seth Tisue <seth@tisue.net> | 2016-09-07 14:17:35 -0700 |
---|---|---|
committer | Seth Tisue <seth@tisue.net> | 2016-10-24 17:45:52 -0700 |
commit | e0a8ffe88740995150fa7ca58797a4cceed3169f (patch) | |
tree | 79e2dade4a231364d2aedc8e8f8f0d0b034a87c4 /src/library/scala/util/Either.scala | |
parent | 501c21260cff006e7cf2e79739d8319c4dc79901 (diff) | |
download | scala-e0a8ffe88740995150fa7ca58797a4cceed3169f.tar.gz scala-e0a8ffe88740995150fa7ca58797a4cceed3169f.tar.bz2 scala-e0a8ffe88740995150fa7ca58797a4cceed3169f.zip |
assorted typo fixes, cleanup, updating of comments
just in time for Halloween. "boostrap" is definitely the most
adorable typo evah -- and one of the most common, too. but we don't
want to scare anybody.
Diffstat (limited to 'src/library/scala/util/Either.scala')
-rw-r--r-- | src/library/scala/util/Either.scala | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/library/scala/util/Either.scala b/src/library/scala/util/Either.scala index c332f18295..7bded972f2 100644 --- a/src/library/scala/util/Either.scala +++ b/src/library/scala/util/Either.scala @@ -55,31 +55,31 @@ package util * val left23: Left[Double, Int] = Left(23.0) * val left42 = Left(42.0) * - * for ( - * a <- right1; - * b <- right2; + * for { + * a <- right1 + * b <- right2 * c <- right3 - * ) yield a + b + c // Right(6) + * } yield a + b + c // Right(6) * - * for ( - * a <- right1; - * b <- right2; + * for { + * a <- right1 + * b <- right2 * c <- left23 - * ) yield a + b + c // Left(23.0) + * } yield a + b + c // Left(23.0) * - * for ( - * a <- right1; - * b <- left23; + * for { + * a <- right1 + * b <- left23 * c <- right2 - * ) yield a + b + c // Left(23.0) + * } yield a + b + c // Left(23.0) * * // It is advisable to provide the type of the “missing” value (especially the right value for `Left`) * // as otherwise that type might be infered as `Nothing` without context: - * for ( - * a <- left23; - * b <- right1; + * for { + * a <- left23 + * b <- right1 * c <- left42 // type at this position: Either[Double, Nothing] - * ) yield a + b + c + * } yield a + b + c * // ^ * // error: ambiguous reference to overloaded definition, * // both method + in class Int of type (x: Char)Int @@ -136,10 +136,10 @@ sealed abstract class Either[+A, +B] extends Product with Serializable { * @example {{{ * val right = Right(2) * val left = Left(3) - * for ( - * r1 <- right; + * for { + * r1 <- right * r2 <- left.swap - * ) yield r1 * r2 // Right(6) + * } yield r1 * r2 // Right(6) * }}} */ def swap: Either[B, A] = this match { |