final class OneAnd[F[_], A] extends AnyRef
A generalization of NonEmptyList
to non-List
things. For
example, OneAnd[Vector, A]
is a non-empty Vector
of A
.
Only head
and tail
are provided as direct methods, because
there's little you can do with a OneAnd
without knowing a bit
about F
. So useful functions are provided in the form of
typeclass instances on OneAnd
's companion; in combination with
syntax extensions provided by scalaz.syntax
, OneAnd
has a
large possible set of methods available by importing. For
example, Applicative
on this requires ApplicativePlus[F]
, and
Traverse1
on this requires Traverse[F]
. See the companion
documentation for a complete list of instances.
Additionally, unlike λ[α => (α, F[α])]
, the behavior of typeclass
operations on OneAnd
should 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 two OneAnd[Vector, *]
s or NonEmptyList
s of lengths
*a* and *b* yields a sequence of same type of length *a*×*b*, but
two λ[α => (α, Vector[α])]
s of length *c* and *d* ap
to one of
length 1+(*c*–1)×(*d*–1). For another example, point
of the
former two yield a one-element sequence, but point
of the latter
yields a two-element sequence.
- Source
- OneAnd.scala
- Since
7.0.3
- Alphabetic
- By Inheritance
- OneAnd
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
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
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(that: Any): Boolean
- Definition Classes
- OneAnd → AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- OneAnd → AnyRef → Any
- def head: A
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- 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()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def tail: F[A]
- def toString(): String
- Definition Classes
- OneAnd → AnyRef → Any
- 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()