diff options
author | Geoffrey Washburn <geoffrey.washburn@epfl.ch> | 2008-04-24 06:58:18 +0000 |
---|---|---|
committer | Geoffrey Washburn <geoffrey.washburn@epfl.ch> | 2008-04-24 06:58:18 +0000 |
commit | dcfbdbfd10868cff05a085dc132516d8e5f1c011 (patch) | |
tree | 77ecea28c20aee0257a53e7de1d406b9cf2b9705 | |
parent | 8faf3103413a33a3593a5da0d4083613b1d0c5c0 (diff) | |
download | scala-dcfbdbfd10868cff05a085dc132516d8e5f1c011.tar.gz scala-dcfbdbfd10868cff05a085dc132516d8e5f1c011.tar.bz2 scala-dcfbdbfd10868cff05a085dc132516d8e5f1c011.zip |
Changed most uses of lazy val in Either to be d...
Changed most uses of lazy val in Either to be defs.
-rw-r--r-- | src/library/scala/Either.scala | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/library/scala/Either.scala b/src/library/scala/Either.scala index 990141a883..70c755b932 100644 --- a/src/library/scala/Either.scala +++ b/src/library/scala/Either.scala @@ -16,12 +16,12 @@ sealed trait Either[+A, +B] { /** * Projects this <code>Either</code> as a <code>Left</code>. */ - lazy val left = Either.LeftProjection(this) + def left = Either.LeftProjection(this) /** * Projects this <code>Either</code> as a <code>Right</code>. */ - lazy val right = Either.RightProjection(this) + def right = Either.RightProjection(this) /** * Deconstruction of the <code>Either</code> type (in contrast to pattern matching). @@ -34,7 +34,7 @@ sealed trait Either[+A, +B] { /** * If this is a <code>Left</code>, then return the left value in <code>Right</code> or vice versa. */ - lazy val swap = this match { + def swap = this match { case Left(a) => Right(a) case Right(b) => Left(b) } @@ -84,7 +84,7 @@ object Either { * * @throws Predef.NoSuchElementException if the option is empty. */ - lazy val get = e match { + def get = e match { case Left(a) => a case Right(_) => throw new NoSuchElementException("Either.left.value on Right") } @@ -157,7 +157,7 @@ object Either { * Returns a <code>Seq</code> containing the <code>Left</code> value if it exists or an empty * <code>Seq</code> if this is a <code>Right</code>. */ - lazy val toSeq = e match { + def toSeq = e match { case Left(a) => Seq.singleton(a) case Right(_) => Seq.empty } @@ -166,7 +166,7 @@ object Either { * Returns a <code>Some</code> containing the <code>Left</code> value if it exists or a * <code>None</code> if this is a <code>Right</code>. */ - lazy val toOption = e match { + def toOption = e match { case Left(a) => Some(a) case Right(_) => None } @@ -185,7 +185,7 @@ object Either { * * @throws Predef.NoSuchElementException if the projection is <code>Left</code>. */ - lazy val get = e match { + def get = e match { case Left(_) => throw new NoSuchElementException("Either.right.value on Left") case Right(a) => a } @@ -258,7 +258,7 @@ object Either { * Returns a <code>Seq</code> containing the <code>Right</code> value if it exists or an empty * <code>Seq</code> if this is a <code>Left</code>. */ - lazy val toSeq = e match { + def toSeq = e match { case Left(_) => Seq.empty case Right(b) => Seq.singleton(b) } @@ -267,7 +267,7 @@ object Either { * Returns a <code>Some</code> containing the <code>Right</code> value if it exists or a * <code>None</code> if this is a <code>Left</code>. */ - lazy val toOption = e match { + def toOption = e match { case Left(_) => None case Right(b) => Some(b) } |