PSVec

dev.constructive.eo.data.PSVec
See thePSVec companion trait
object PSVec

Constructors for PSVec — the primary entry points are empty, singleton, and unsafeWrap (zero-copy from an Array[Any]). The three Slice / Single / Empty subclasses are internal to the dev.constructive.eo.data package and stable across release lines only at the aggregate PSVec supertype level.

Attributes

Companion
trait
Source
PSVec.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
PSVec.type

Members list

Grouped members

Instances

cats.Foldable — index-based foldLeft, Eval-deferred foldRight (stack-safe), O(1) size.

cats.Foldable — index-based foldLeft, Eval-deferred foldRight (stack-safe), O(1) size.

Attributes

Source
PSVec.scala
object pSVecFoldable extends Foldable[PSVec]

cats.Foldable — index-based foldLeft, Eval-deferred foldRight (stack-safe), O(1) size.

cats.Foldable — index-based foldLeft, Eval-deferred foldRight (stack-safe), O(1) size.

Attributes

Source
PSVec.scala
Supertypes
trait Foldable[PSVec]
trait Serializable
class Object
trait Matchable
class Any
Show all
Self type

cats.Functor — index-based map into one fresh backing array (0/1-element results normalise through unsafeWrap to Empty / Single).

cats.Functor — index-based map into one fresh backing array (0/1-element results normalise through unsafeWrap to Empty / Single).

Attributes

Source
PSVec.scala
object pSVecFunctor extends Functor[PSVec]

cats.Functor — index-based map into one fresh backing array (0/1-element results normalise through unsafeWrap to Empty / Single).

cats.Functor — index-based map into one fresh backing array (0/1-element results normalise through unsafeWrap to Empty / Single).

Attributes

Source
PSVec.scala
Supertypes
trait Functor[PSVec]
trait Invariant[PSVec]
trait Serializable
class Object
trait Matchable
class Any
Show all
Self type

cats.Traverse — the instance Traversal's .modifyA / .all route through when the carrier is MultiFocus[PSVec]. Effects run left-to-right in index order, results land in one pre-sized backing array threaded through G.map2 (no per-element vector rebuild).

cats.Traverse — the instance Traversal's .modifyA / .all route through when the carrier is MultiFocus[PSVec]. Effects run left-to-right in index order, results land in one pre-sized backing array threaded through G.map2 (no per-element vector rebuild).

Attributes

Source
PSVec.scala
object pSVecTraverse extends Traverse[PSVec]

cats.Traverse — the instance Traversal's .modifyA / .all route through when the carrier is MultiFocus[PSVec]. Effects run left-to-right in index order, results land in one pre-sized backing array threaded through G.map2 (no per-element vector rebuild).

cats.Traverse — the instance Traversal's .modifyA / .all route through when the carrier is MultiFocus[PSVec]. Effects run left-to-right in index order, results land in one pre-sized backing array threaded through G.map2 (no per-element vector rebuild).

Attributes

Source
PSVec.scala
Supertypes
trait Traverse[PSVec]
trait Foldable[PSVec]
trait Functor[PSVec]
trait Invariant[PSVec]
trait Serializable
class Object
trait Matchable
class Any
Show all
Self type

Type members

Classlikes

case object Empty extends PSVec[Nothing]

Zero-element shared singleton; Prism / Affine miss branches allocate nothing.

Zero-element shared singleton; Prism / Affine miss branches allocate nothing.

Attributes

Source
PSVec.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait PSVec[Nothing]
trait IterableOnce[Nothing]
class Object
trait Matchable
class Any
Show all
Self type
Empty.type
final class Single[+B](val b: B) extends PSVec[B]

Single-element vector — stores the element inline, no backing array.

Single-element vector — stores the element inline, no backing array.

Attributes

Source
PSVec.scala
Supertypes
trait PSVec[B]
trait IterableOnce[B]
class Object
trait Matchable
class Any
final class Slice[+B] extends PSVec[B]

Array-backed view with offset + length. slice is a pointer update over the shared backing array — the zero-copy reassembly path mfAssocPSVec depends on.

Array-backed view with offset + length. slice is a pointer update over the shared backing array — the zero-copy reassembly path mfAssocPSVec depends on.

Attributes

Source
PSVec.scala
Supertypes
trait PSVec[B]
trait IterableOnce[B]
class Object
trait Matchable
class Any

Value members

Concrete methods

def empty[B]: PSVec[B]

Zero-length shared vector.

Zero-length shared vector.

Attributes

Source
PSVec.scala
def from[B](xs: IterableOnce[B]): PSVec[B]

Build a PSVec from any collection. A PSVec passes through untouched; ArraySeq.ofRef's backing array is aliased zero-copy (safe: ArraySeq is immutable and no PSVec operation mutates a wrapped array); every other shape collects through the stdlib Iterator.toArray (exact-fill when knownSize is known, ArrayBuilder otherwise), specialised at 0 / 1 by unsafeWrap.

Build a PSVec from any collection. A PSVec passes through untouched; ArraySeq.ofRef's backing array is aliased zero-copy (safe: ArraySeq is immutable and no PSVec operation mutates a wrapped array); every other shape collects through the stdlib Iterator.toArray (exact-fill when knownSize is known, ArrayBuilder otherwise), specialised at 0 / 1 by unsafeWrap.

Attributes

Source
PSVec.scala
def from[B](arr: Array[B]): PSVec[B]

Build a PSVec from an Array — one defensive copy (Array.copyAs: an intrinsic arraycopy for reference arrays, a boxing fill for primitive ones). The array is caller-owned and mutable, so it can NOT be aliased the way immutable ArraySeq.ofRef's backing is. Also spares the Predef.genericWrapArray allocation the IterableOnce overload would force on an Array argument.

Build a PSVec from an Array — one defensive copy (Array.copyAs: an intrinsic arraycopy for reference arrays, a boxing fill for primitive ones). The array is caller-owned and mutable, so it can NOT be aliased the way immutable ArraySeq.ofRef's backing is. Also spares the Predef.genericWrapArray allocation the IterableOnce overload would force on an Array argument.

Attributes

Source
PSVec.scala
def from[T[_] : Foldable, A](ta: T[A]): PSVec[A]

from for any Foldable container, in fold order. An IterableOnce-backed container — PSVec itself included — routes through the structural overload (sound whenever the instance folds in iteration order, as every cats instance does); anything else collects through its own foldLeft.

from for any Foldable container, in fold order. An IterableOnce-backed container — PSVec itself included — routes through the structural overload (sound whenever the instance folds in iteration order, as every cats instance does); anything else collects through its own foldLeft.

Attributes

Source
PSVec.scala
def of[B](b0: B, b1: B): PSVec[B]

Two-element vector — builds the backing array directly, no List / Iterable intermediate. The common arity for binary-tree children (recursion-scheme coalgebras, Node(l, r)), where PSVec.of(l, r) replaces the wasteful from(List(l, r)).

Two-element vector — builds the backing array directly, no List / Iterable intermediate. The common arity for binary-tree children (recursion-scheme coalgebras, Node(l, r)), where PSVec.of(l, r) replaces the wasteful from(List(l, r)).

Attributes

Source
PSVec.scala
def singleton[B](b: B): PSVec[B]

Single-element vector, stored inline (no backing array).

Single-element vector, stored inline (no backing array).

Attributes

Source
PSVec.scala
def unsafeWrap[B](arr: Array[Any]): PSVec[B]

Wrap an Array[Any] verbatim as a PSVec. Shares ownership with the caller. Returns the most specialised variant for the array's length so callers need not special-case empty / singleton themselves.

Wrap an Array[Any] verbatim as a PSVec. Shares ownership with the caller. Returns the most specialised variant for the array's length so callers need not special-case empty / singleton themselves.

Attributes

Source
PSVec.scala