Packages

  • package root
    Definition Classes
    root
  • package cats

    The cats root package contains all the trait signatures of most Scala type classes.

    The cats root package contains all the trait signatures of most Scala type classes.

    Cats type classes are implemented using the approach from the Type classes as objects and implicits article.

    For each type class, cats provides three pieces: - Its signature: a trait that is polymorphic on a type parameter. Type class traits inherit from other type classes to indicate that any implementation of the lower type class (e.g. Applicative) can also serve as an instance for the higuer type class (e.g. Functor). - Type class 'instances, which are classes and objects that implement one or more type class signatures for some specific types. Type class instances for several data types from the Java or Scala standard libraries are declared in the subpackage cats.instances. - Syntax extensions, each of which provides the methods of the type class defines as extension methods (which in Scala 2 are encoded as implicit classes) for values of any type F; given that an instance of the type class for the receiver type (this) is in the implicit scope. Symtax extensions are declared in the cats.syntax package. - A set of laws, that are also generic on the type of the class, and are only defined on the operations of the type class. The purpose of these laws is to declare some algebraic relations (equations) between Scala expressions involving the operations of the type class, and test (but not verify) that implemented instances satisfy those equations. Laws are defined in the cats-laws package.

    Although most of cats type classes are declared in this package, some are declared in other packages: - type classes that operate on base types (kind *), and their implementations for standard library types, are contained in cats.kernel, which is a different SBT project. However, they are re-exported from this package. - type classes of kind F[_, _], such as cats.arrow.Profunctor" or cats.arrow.Arrow, which are relevant for Functional Reactive Programming or optics, are declared in the cats.arrow package. - Also, those type classes that abstract over (pure or impure) functional runtime effects are declared in the cats-effect library. - Some type classes for which no laws can be provided are left out of the main road, in a small and dirty alley. These are the alleycats.

    Definition Classes
    root
  • package data
    Definition Classes
    cats
  • AndThen
  • AppFunc
  • Binested
  • BinestedBifoldable
  • BinestedBitraverse
  • BinestedInstances
  • Chain
  • Cokleisli
  • Const
  • Cont
  • ContT
  • EitherK
  • EitherT
  • Func
  • IdT
  • IndexedReaderWriterStateT
  • IndexedState
  • IndexedStateT
  • Ior
  • IorT
  • Kleisli
  • Nested
  • NonEmptyChainOps
  • NonEmptyList
  • NonEmptyMapOps
  • NonEmptySetOps
  • NonEmptyVector
  • OneAnd
  • Op
  • OptionT
  • Reader
  • ReaderWriterState
  • ReaderWriterStateT
  • RepresentableStore
  • State
  • StateT
  • Store
  • Tuple2K
  • Validated
  • Writer
  • WriterT
  • ZipList
  • ZipStream
  • ZipVector
c

cats.data

NonEmptyChainOps

final class NonEmptyChainOps[A] extends AnyVal with NonEmptyCollection[A, Chain, NonEmptyChain]

Linear Supertypes
NonEmptyCollection[A, Chain, NonEmptyChain], AnyVal, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. NonEmptyChainOps
  2. NonEmptyCollection
  3. AnyVal
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new NonEmptyChainOps(value: NonEmptyChain[A])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##(): Int
    Definition Classes
    Any
  3. final def ++[A2 >: A](c: NonEmptyChain[A2]): NonEmptyChain[A2]

    Alias for concat

  4. final def ++:[A2 >: A](c: Chain[A2]): NonEmptyChain[A2]

    Alias for prependChain

    Alias for prependChain

    scala> import cats.data.NonEmptyChain
    scala> val nec = NonEmptyChain(4, 5, 6)
    scala> Chain(1, 2, 3) ++: nec
    res0: cats.data.NonEmptyChain[Int] = Chain(1, 2, 3, 4, 5, 6)
  5. final def +:[A2 >: A](a: A2): NonEmptyChain[A2]

    Alias for prepend.

  6. final def :+[A2 >: A](a: A2): NonEmptyChain[A2]

    Alias for append.

  7. final def :++[A2 >: A](c: Chain[A2]): NonEmptyChain[A2]

    Alias for appendChain

    Alias for appendChain

    scala> import cats.data.NonEmptyChain
    scala> val nec = NonEmptyChain(1, 2, 4, 5)
    scala> nec :++ Chain(3, 6, 9)
    res0: cats.data.NonEmptyChain[Int] = Chain(1, 2, 4, 5, 3, 6, 9)
  8. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  9. final def append[A2 >: A](a: A2): NonEmptyChain[A2]

    Returns a new Chain consisting of this followed by a.

    Returns a new Chain consisting of this followed by a. O(1) runtime.

    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  10. final def appendChain[A2 >: A](c: Chain[A2]): NonEmptyChain[A2]

    Appends the given chain in O(1) runtime.

  11. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  12. final def collect[B](pf: PartialFunction[A, B]): Chain[B]

    Returns a new Chain containing all elements where the result of pf is final defined.

    Returns a new Chain containing all elements where the result of pf is final defined.

    scala> import cats.data.NonEmptyChain
    scala> import cats.implicits._
    scala> val nec = NonEmptyChain(4, 5, 6).map(n => if (n % 2 == 0) Some(n) else None)
    scala> nec.collect { case Some(n) => n }
    res0: cats.data.Chain[Int] = Chain(4, 6)
    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  13. final def collectFirst[B](pf: PartialFunction[A, B]): Option[B]

    Finds the first element of this NonEmptyChain for which the given partial function is defined, and applies the partial function to it.

  14. final def collectFirstSome[B](f: (A) ⇒ Option[B]): Option[B]

    Like collectFirst from scala.collection.Traversable but takes A => Option[B] instead of PartialFunctions.

  15. final def concat[A2 >: A](c: NonEmptyChain[A2]): NonEmptyChain[A2]

    Concatenates this with c in O(1) runtime.

    Concatenates this with c in O(1) runtime.

    scala> import cats.data.NonEmptyChain
    scala> val nec = NonEmptyChain(1, 2, 4, 5)
    scala> nec ++ NonEmptyChain(7, 8)
    res0: cats.data.NonEmptyChain[Int] = Chain(1, 2, 4, 5, 7, 8)
  16. final def contains(a: A)(implicit A: kernel.Eq[A]): Boolean

    Tests if some element is contained in this chain.

    Tests if some element is contained in this chain.

    scala> import cats.data.NonEmptyChain
    scala> import cats.implicits._
    scala> val nec = NonEmptyChain(4, 5, 6)
    scala> nec.contains(5)
    res0: Boolean = true
  17. final def deleteFirst(f: (A) ⇒ Boolean): Option[(A, Chain[A])]

    Yields to Some(a, Chain[A]) with a removed where f holds for the first time, otherwise yields None, if a was not found Traverses only until a is found.

  18. final def distinct[AA >: A](implicit O: Order[AA]): NonEmptyChain[AA]

    Remove duplicates.

    Remove duplicates. Duplicates are checked using Order[_] instance.

    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  19. final def exists(f: (A) ⇒ Boolean): Boolean

    Tests whether a predicate holds for at least one element of this chain.

    Tests whether a predicate holds for at least one element of this chain.

    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  20. final def filter(p: (A) ⇒ Boolean): Chain[A]

    Filters all elements of this chain that do not satisfy the given predicate.

    Filters all elements of this chain that do not satisfy the given predicate.

    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  21. final def filterNot(p: (A) ⇒ Boolean): Chain[A]

    Filters all elements of this chain that satisfy the given predicate.

    Filters all elements of this chain that satisfy the given predicate.

    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  22. final def find(f: (A) ⇒ Boolean): Option[A]

    Returns the first value that matches the given predicate.

    Returns the first value that matches the given predicate.

    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  23. final def flatMap[B](f: (A) ⇒ NonEmptyChain[B]): NonEmptyChain[B]

    Applies the supplied function to each element and returns a new NonEmptyChain from the concatenated results

  24. final def foldLeft[B](b: B)(f: (B, A) ⇒ B): B

    Left-associative fold using f.

    Left-associative fold using f.

    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  25. final def foldRight[B](z: B)(f: (A, B) ⇒ B): B

    Right-associative fold using f.

  26. final def forall(p: (A) ⇒ Boolean): Boolean

    Tests whether a predicate holds for all elements of this chain.

    Tests whether a predicate holds for all elements of this chain.

    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  27. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  28. final def groupBy[B](f: (A) ⇒ B)(implicit B: Order[B]): NonEmptyMap[B, NonEmptyChain[A]]

    Groups elements inside this NonEmptyChain according to the Order of the keys produced by the given mapping function.

  29. final def groupByNem[B](f: (A) ⇒ B)(implicit B: Order[B]): NonEmptyMap[B, NonEmptyChain[A]]
    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  30. final def head: A

    Returns the first element of this NonEmptyChain.

    Returns the first element of this NonEmptyChain. Amortized O(1).

    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  31. final def init: Chain[A]

    Returns all but the last element of this NonEmptyChain.

    Returns all but the last element of this NonEmptyChain. Amortized O(1).

    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  32. final def initLast: (Chain[A], A)

    Returns the init and last of this NonEmptyChain.

    Returns the init and last of this NonEmptyChain. Amortized O(1).

  33. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  34. final def iterator: Iterator[A]
    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  35. final def last: A

    Returns the last element of this NonEmptyChain.

    Returns the last element of this NonEmptyChain. Amortized O(1).

    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  36. final def length: Long

    Returns the number of elements in this chain.

  37. final def map[B](f: (A) ⇒ B): NonEmptyChain[B]

    Applies the supplied function to each element and returns a new NonEmptyChain.

    Applies the supplied function to each element and returns a new NonEmptyChain.

    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  38. final def prepend[A2 >: A](a: A2): NonEmptyChain[A2]

    Returns a new NonEmptyChain consisting of a followed by this.

    Returns a new NonEmptyChain consisting of a followed by this. O(1) runtime.

    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  39. final def prependChain[A2 >: A](c: Chain[A2]): NonEmptyChain[A2]

    Prepends the given chain in O(1) runtime.

  40. final def reduce[AA >: A](implicit S: Semigroup[AA]): AA

    Reduce using the Semigroup of A

    Reduce using the Semigroup of A

    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  41. final def reduceLeft(f: (A, A) ⇒ A): A

    Left-associative reduce using f.

    Left-associative reduce using f.

    scala> import cats.data.NonEmptyChain
    scala> val nec = NonEmptyChain(4, 5, 6)
    scala> nec.reduceLeft(_ + _)
    res0: Int = 15
  42. final def reduceLeftTo[B](f: (A) ⇒ B)(g: (B, A) ⇒ B): B

    Apply f to the "initial element" of this chain and lazily combine it with every other value using the given function g.

    Apply f to the "initial element" of this chain and lazily combine it with every other value using the given function g.

    scala> import cats.data.NonEmptyChain
    scala> val nec = NonEmptyChain(4, 5, 6)
    scala> nec.reduceLeftTo(_.toString)((acc, cur) => acc + cur.toString)
    res0: String = 456
  43. final def reduceRight(f: (A, A) ⇒ A): A

    Right-associative reduce using f.

    Right-associative reduce using f.

    scala> import cats.data.NonEmptyChain
    scala> val nec = NonEmptyChain(4, 5, 6)
    scala> nec.reduceRight(_ + _)
    res0: Int = 15
  44. final def reduceRightTo[B](f: (A) ⇒ B)(g: (A, B) ⇒ B): B

    Apply f to the "initial element" of this chain and lazily combine it with every other value using the given function g.

    Apply f to the "initial element" of this chain and lazily combine it with every other value using the given function g.

    scala> import cats.data.NonEmptyChain
    scala> val nec = NonEmptyChain(4, 5, 6)
    scala> nec.reduceRightTo(_.toString)((cur, acc) => acc + cur.toString)
    res0: String = 654
  45. final def reverse: NonEmptyChain[A]

    Reverses this NonEmptyChain

    Reverses this NonEmptyChain

    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  46. final def reverseIterator: Iterator[A]
  47. final def show[AA >: A](implicit AA: Show[AA]): String
    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  48. final def sortBy[B](f: (A) ⇒ B)(implicit B: Order[B]): NonEmptyChain[A]
    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  49. final def sorted[AA >: A](implicit AA: Order[AA]): NonEmptyChain[AA]
    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  50. final def tail: Chain[A]

    Returns all but the first element of this NonEmptyChain.

    Returns all but the first element of this NonEmptyChain. Amortized O(1).

    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  51. final def toChain: Chain[A]

    Converts this chain to a Chain

  52. final def toNem[T, V](implicit ev: <:<[A, (T, V)], order: Order[T]): NonEmptyMap[T, V]
    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  53. final def toNes[B >: A](implicit order: Order[B]): NonEmptySet[B]
    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  54. final def toNonEmptyList: NonEmptyList[A]

    Converts this chain to a NonEmptyList.

    Converts this chain to a NonEmptyList.

    scala> import cats.data.NonEmptyChain
    scala> val nec = NonEmptyChain(1, 2, 3, 4, 5)
    scala> nec.toNonEmptyList
    res0: cats.data.NonEmptyList[Int] = NonEmptyList(1, 2, 3, 4, 5)
  55. final def toNonEmptyVector: NonEmptyVector[A]

    Converts this chain to a NonEmptyVector.

    Converts this chain to a NonEmptyVector.

    scala> import cats.data.NonEmptyChain
    scala> val nec = NonEmptyChain(1, 2, 3, 4, 5)
    scala> nec.toNonEmptyVector
    res0: cats.data.NonEmptyVector[Int] = NonEmptyVector(1, 2, 3, 4, 5)
  56. def toString(): String
    Definition Classes
    Any
  57. final def uncons: (A, Chain[A])

    Returns the head and tail of this NonEmptyChain.

    Returns the head and tail of this NonEmptyChain. Amortized O(1).

  58. final def zipWith[B, C](b: NonEmptyChain[B])(f: (A, B) ⇒ C): NonEmptyChain[C]

    Zips this NonEmptyChain with another NonEmptyChain and applies a function for each pair of elements.

    Zips this NonEmptyChain with another NonEmptyChain and applies a function for each pair of elements.

    scala> import cats.data.NonEmptyChain
    scala> val as = NonEmptyChain(1, 2, 3)
    scala> val bs = NonEmptyChain("A", "B", "C")
    scala> as.zipWith(bs)(_.toString + _)
    res0: cats.data.NonEmptyChain[String] = Chain(1A, 2B, 3C)
    Definition Classes
    NonEmptyChainOps → NonEmptyCollection
  59. final def zipWithIndex: NonEmptyChain[(A, Int)]
    Definition Classes
    NonEmptyChainOps → NonEmptyCollection

Inherited from NonEmptyCollection[A, Chain, NonEmptyChain]

Inherited from AnyVal

Inherited from Any

Ungrouped