Skip to content

Commit

Permalink
Add doctest for NEL.::: and NEV.++:
Browse files Browse the repository at this point in the history
  • Loading branch information
JCranky committed Oct 5, 2017
1 parent 3d04c57 commit e1096ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/src/main/scala/cats/data/NonEmptyList.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions core/src/main/scala/cats/data/NonEmptyVector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit e1096ff

Please sign in to comment.