final
case class
OneAnd[F[_], A](head: A, tail: F[A]) extends Product with Serializable
Instance Constructors
-
new
OneAnd(head: A, tail: F[A])
Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
val
head: A
-
final
def
isInstanceOf[T0]: Boolean
-
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
val
tail: F[A]
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
A generalization of
NonEmptyListto non-Listthings. For example,OneAnd[Vector, A]is a non-emptyVectorofA.Only
headandtailare provided as direct methods, because there's little you can do with aOneAndwithout knowing a bit aboutF. So useful functions are provided in the form of typeclass instances onOneAnd's companion; in combination with syntax extensions provided byscalaz.syntax,OneAndhas a large possible set of methods available by importing. For example,Applicativeon this requiresApplicativePlus[F], andTraverse1on this requiresTraverse[F]. See the companion documentation for a complete list of instances.Additionally, unlike
λ[α => (α, F[α])], the behavior of typeclass operations onOneAndshould be preserved across the natural transformation to scalaz.NonEmptyList where one exists. That is it should "be like" a nonempty structure. For example,ap-ing twoOneAnd[Vector, ?]s orNonEmptyLists of lengths *a* and *b* yields a sequence of same type of length *a*×*b*, but twoλ[α => (α, Vector[α])]s of length *c* and *d*apto one of length 1+(*c*–1)×(*d*–1). For another example,pointof the former two yield a one-element sequence, butpointof the latter yields a two-element sequence.7.0.3