Class/Object

cats.data

OneAnd

Related Docs: object OneAnd | package data

Permalink

final case class OneAnd[F[_], A](head: A, tail: F[A]) extends Product with Serializable

A data type which represents a single element (head) and some other structure (tail). As we have done in package.scala, this can be used to represent a Stream which is guaranteed to not be empty:

type NonEmptyStream[A] = OneAnd[Stream, A]
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. OneAnd
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new OneAnd(head: A, tail: F[A])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def ===(that: OneAnd[F, A])(implicit A: Eq[A], FA: Eq[F[A]]): Boolean

    Permalink

    Typesafe equality operator.

    Typesafe equality operator.

    This method is similar to == except that it only allows two OneAnd[F, A] values to be compared to each other, and uses equality provided by Eq[_] instances, rather than using the universal equality provided by .equals.

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def combine(other: OneAnd[F, A])(implicit F: Alternative[F]): OneAnd[F, A]

    Permalink

    Append another OneAnd to this

  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def exists(p: (A) ⇒ Boolean)(implicit F: Foldable[F]): Boolean

    Permalink

    Check whether at least one element satisfies the predicate.

  10. def filter(f: (A) ⇒ Boolean)(implicit FA: Alternative[F], FM: Monad[F]): F[A]

    Permalink

    remove elements not matching the predicate

  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. def find(f: (A) ⇒ Boolean)(implicit F: Foldable[F]): Option[A]

    Permalink

    find the first element matching the predicate, if one exists

  13. def foldLeft[B](b: B)(f: (B, A) ⇒ B)(implicit F: Foldable[F]): B

    Permalink

    Left-associative fold on the structure using f.

  14. def foldRight[B](lb: Eval[B])(f: (A, Eval[B]) ⇒ Eval[B])(implicit F: Foldable[F]): Eval[B]

    Permalink

    Right-associative fold on the structure using f.

  15. def forall(p: (A) ⇒ Boolean)(implicit F: Foldable[F]): Boolean

    Permalink

    Check whether all elements satisfy the predicate.

  16. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  17. val head: A

    Permalink
  18. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  19. def map[B](f: (A) ⇒ B)(implicit F: Functor[F]): OneAnd[F, B]

    Permalink

    Applies f to all the elements of the structure

  20. def mapK[G[_]](f: ~>[F, G]): OneAnd[G, A]

    Permalink

    Modify the context F using transformation f.

  21. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. def reduceLeft(f: (A, A) ⇒ A)(implicit F: Foldable[F]): A

    Permalink
  25. def show(implicit A: Show[A], FA: Show[F[A]]): String

    Permalink

    Typesafe stringification method.

    Typesafe stringification method.

    This method is similar to .toString except that it stringifies values according to Show[_] instances, rather than using the universal .toString method.

  26. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  27. val tail: F[A]

    Permalink
  28. def unwrap(implicit F: Alternative[F]): F[A]

    Permalink

    Combine the head and tail into a single F[A] value.

  29. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped