Skip to content

Commit

Permalink
add map to NonEmptyChain. (#2939)
Browse files Browse the repository at this point in the history
* add map to NonEmptyChain.

* Re-merge

the `map` method is provided by the `Functor` instance of `Chain`
  • Loading branch information
tanaka takaya authored and kailuowang committed Jul 22, 2019
1 parent 7e94169 commit c313eb0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/src/main/scala/cats/data/NonEmptyChain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,12 @@ class NonEmptyChainOps[A](private val value: NonEmptyChain[A]) extends AnyVal {
final def reduce[AA >: A](implicit S: Semigroup[AA]): AA =
S.combineAllOption(iterator).get

/**
* Applies the supplied function to each element and returns a new NonEmptyChain.
*/
final def map[B](f: A => B): NonEmptyChain[B] =
create(toChain.map(f))

/**
* Applies the supplied function to each element and returns a new NonEmptyChain from the concatenated results
*/
Expand Down

0 comments on commit c313eb0

Please sign in to comment.