diff options
author | Johannes Rudolph <johannes_rudolph@gmx.de> | 2012-05-30 15:05:03 +0200 |
---|---|---|
committer | Johannes Rudolph <johannes_rudolph@gmx.de> | 2012-05-30 15:05:03 +0200 |
commit | 50e5220acbb897fd3137bfad32c8cd924cc1f477 (patch) | |
tree | d825a2fd8091b436d199feac0e8c8da69bff765f /src/main/scala/cc | |
parent | 475afb622f6ad4b9a71aad30315f26be123fd966 (diff) | |
download | spray-json-50e5220acbb897fd3137bfad32c8cd924cc1f477.tar.gz spray-json-50e5220acbb897fd3137bfad32c8cd924cc1f477.tar.bz2 spray-json-50e5220acbb897fd3137bfad32c8cd924cc1f477.zip |
renamed `swap` -> `toSeq`
Diffstat (limited to 'src/main/scala/cc')
-rw-r--r-- | src/main/scala/cc/spray/json/JsonLenses.scala | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/scala/cc/spray/json/JsonLenses.scala b/src/main/scala/cc/spray/json/JsonLenses.scala index e300c32..a20823e 100644 --- a/src/main/scala/cc/spray/json/JsonLenses.scala +++ b/src/main/scala/cc/spray/json/JsonLenses.scala @@ -116,7 +116,7 @@ object JsonLenses { trait Ops[M[_]] { def flatMap[T, U](els: M[T])(f: T => Seq[U]): Seq[U] def allRight[T](v: Seq[Validated[T]]): Validated[M[T]] - def swap[T](v: Validated[M[T]]): Seq[Validated[T]] + def toSeq[T](v: Validated[M[T]]): Seq[Validated[T]] def map[T, U](els: M[T])(f: T => U): Seq[U] = flatMap(els)(v => Seq(f(v))) @@ -125,7 +125,7 @@ object JsonLenses { implicit def idOps: Ops[Id] = new Ops[Id] { def flatMap[T, U](els: T)(f: T => Seq[U]): Seq[U] = f(els) def allRight[T](v: Seq[Validated[T]]): Validated[T] = v.head - def swap[T](v: Validated[T]): Seq[Validated[T]] = Seq(v) + def toSeq[T](v: Validated[T]): Seq[Validated[T]] = Seq(v) } implicit def optionOps: Ops[Option] = new Ops[Option] { def flatMap[T, U](els: Option[T])(f: T => Seq[U]): Seq[U] = @@ -138,7 +138,7 @@ object JsonLenses { case Seq(Left(e)) => Left(e) } - def swap[T](v: Validated[Option[T]]): Seq[Validated[T]] = v match { + def toSeq[T](v: Validated[Option[T]]): Seq[Validated[T]] = v match { case Right(Some(x)) => Seq(Right(x)) case Right(None) => Nil case Left(e) => Seq(Left(e)) @@ -151,7 +151,7 @@ object JsonLenses { def allRight[T](v: Seq[Validated[T]]): Validated[Seq[T]] = allRightF(v) - def swap[T](x: Validated[Seq[T]]): Seq[Validated[T]] = x match { + def toSeq[T](x: Validated[Seq[T]]): Seq[Validated[T]] = x match { case Right(x) => x.map(Right(_)) case Left(e) => List(Left(e)) } @@ -186,7 +186,7 @@ object JsonLenses { def retr: JsValue => Validated[R[JsValue]] = parent => for { outerV <- outer.retr(parent) - innerV <- ops.allRight(outer.ops.flatMap(outerV)(x => next.ops.swap(next.retr(x)))) + innerV <- ops.allRight(outer.ops.flatMap(outerV)(x => next.ops.toSeq(next.retr(x)))) } yield innerV } } |