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]
- Source
- OneAnd.scala
- Alphabetic
- By Inheritance
- OneAnd
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new OneAnd(head: A, tail: F[A])
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def ===(that: OneAnd[F, A])(implicit A: Eq[A], FA: Eq[F[A]]): Boolean
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.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def combine(other: OneAnd[F, A])(implicit F: Alternative[F]): OneAnd[F, A]
Append another OneAnd to this
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def exists(p: (A) => Boolean)(implicit F: Foldable[F]): Boolean
Check whether at least one element satisfies the predicate.
- def filter(f: (A) => Boolean)(implicit FA: Alternative[F], FM: Monad[F]): F[A]
remove elements not matching the predicate
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def find(f: (A) => Boolean)(implicit F: Foldable[F]): Option[A]
find the first element matching the predicate, if one exists
- def foldLeft[B](b: B)(f: (B, A) => B)(implicit F: Foldable[F]): B
Left-associative fold on the structure using f.
- def foldRight[B](lb: Eval[B])(f: (A, Eval[B]) => Eval[B])(implicit F: Foldable[F]): Eval[B]
Right-associative fold on the structure using f.
- def forall(p: (A) => Boolean)(implicit F: Foldable[F]): Boolean
Check whether all elements satisfy the predicate.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- val head: A
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def map[B](f: (A) => B)(implicit F: Functor[F]): OneAnd[F, B]
Applies f to all the elements of the structure
- def mapK[G[_]](f: ~>[F, G]): OneAnd[G, A]
Modify the context
F
using transformationf
. - final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def reduceLeft(f: (A, A) => A)(implicit F: Foldable[F]): A
- def show(implicit A: Show[A], FA: Show[F[A]]): String
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.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- val tail: F[A]
- def unwrap(implicit F: Alternative[F]): F[A]
Combine the head and tail into a single
F[A]
value. - final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()