From e1096ffec51d4e194f61f1d9a34c4d1b83352f19 Mon Sep 17 00:00:00 2001 From: JCranky Date: Thu, 5 Oct 2017 12:03:36 +0200 Subject: [PATCH] Add doctest for NEL.::: and NEV.++: --- core/src/main/scala/cats/data/NonEmptyList.scala | 7 +++++++ core/src/main/scala/cats/data/NonEmptyVector.scala | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/core/src/main/scala/cats/data/NonEmptyList.scala b/core/src/main/scala/cats/data/NonEmptyList.scala index d3377551e0..daf4dea918 100644 --- a/core/src/main/scala/cats/data/NonEmptyList.scala +++ b/core/src/main/scala/cats/data/NonEmptyList.scala @@ -84,6 +84,13 @@ final case class NonEmptyList[+A](head: A, tail: List[A]) { /** * Alias for [[concat]] + * + * {{{ + * scala> import cats.data.NonEmptyList + * scala> val nel = NonEmptyList.of(1, 2, 3) + * scala> nel ::: NonEmptyList.of(4, 5) + * res0: cats.data.NonEmptyList[Int] = NonEmptyList(1, 2, 3, 4, 5) + * }}} */ def :::[AA >: A](other: NonEmptyList[AA]): NonEmptyList[AA] = other.concat(this) diff --git a/core/src/main/scala/cats/data/NonEmptyVector.scala b/core/src/main/scala/cats/data/NonEmptyVector.scala index d634548669..91c3d4d1ea 100644 --- a/core/src/main/scala/cats/data/NonEmptyVector.scala +++ b/core/src/main/scala/cats/data/NonEmptyVector.scala @@ -67,6 +67,13 @@ final class NonEmptyVector[+A] private (val toVector: Vector[A]) extends AnyVal /** * Append this NEV to another NEV, producing a new `NonEmptyVector`. + * + * {{{ + * scala> import cats.data.NonEmptyVector + * scala> val nev = NonEmptyVector.of(1, 2, 3) + * scala> nev ++: NonEmptyVector.of(4, 5) + * res0: cats.data.NonEmptyVector[Int] = NonEmptyVector(1, 2, 3, 4, 5) + * }}} */ def ++:[AA >: A](other: NonEmptyVector[AA]): NonEmptyVector[AA] = other.concatNev(this)