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 Objecttrait Matchableclass 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
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
- Self type
-
pSVecFoldable.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
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
- Self type
-
pSVecFunctor.type
cats.Traverse — the instance Traversal's .modifyA routes through when the carrier is MultiFocus[PSVec]. Effects run left-to-right in index order; results land in one pre-sized backing array (a TraverseBuf) threaded through G.map2.
cats.Traverse — the instance Traversal's .modifyA routes through when the carrier is MultiFocus[PSVec]. Effects run left-to-right in index order; results land in one pre-sized backing array (a TraverseBuf) threaded through G.map2.
That array must not be blindly shared: G may resume a continuation more than once — a multi-shot effect (List, Vector, Chain, LazyList, fs2 Stream, …) once per branch, a product effect (Tuple2K, cats' parallel-composition law) once per component, a re-runnable effect (IO, State, Kleisli, …) once per run. Two rules keep every resumption apart:
- The buffer is allocated INSIDE the first element's continuation, not in a
G.pureseed, so every branch off(fa(0))and every run of the returnedGstarts its own buffer (no shared seed — which is also what makes two concurrent runs of oneIOsafe). - Later continuations CLAIM their slot (TraverseBuf.put): the first writer at
iwrites in place, every further writer aticopies the prefix[0, i)— frozen, since slots are only ever written at the claim frontier — into a buffer of its own.
Single-shot effects (Option, Either, Id, Eval, IO, Validated, …) thus pay what a shared array costs (one array plus one small buffer object, no per-element structure), and multi-shot effects pay one prefix copy per extra branch, bounded by the size of the result they build anyway. The claim is a plain field, not a CAS (a CAS measured ~2× slower here): it assumes no single run of G resumes continuations on one intermediate value from two threads at once, which nothing that re-evaluates its inputs (IO, fs2, Kleisli) does.
Attributes
- Source
- PSVec.scala
cats.Traverse — the instance Traversal's .modifyA routes through when the carrier is MultiFocus[PSVec]. Effects run left-to-right in index order; results land in one pre-sized backing array (a TraverseBuf) threaded through G.map2.
cats.Traverse — the instance Traversal's .modifyA routes through when the carrier is MultiFocus[PSVec]. Effects run left-to-right in index order; results land in one pre-sized backing array (a TraverseBuf) threaded through G.map2.
That array must not be blindly shared: G may resume a continuation more than once — a multi-shot effect (List, Vector, Chain, LazyList, fs2 Stream, …) once per branch, a product effect (Tuple2K, cats' parallel-composition law) once per component, a re-runnable effect (IO, State, Kleisli, …) once per run. Two rules keep every resumption apart:
- The buffer is allocated INSIDE the first element's continuation, not in a
G.pureseed, so every branch off(fa(0))and every run of the returnedGstarts its own buffer (no shared seed — which is also what makes two concurrent runs of oneIOsafe). - Later continuations CLAIM their slot (TraverseBuf.put): the first writer at
iwrites in place, every further writer aticopies the prefix[0, i)— frozen, since slots are only ever written at the claim frontier — into a buffer of its own.
Single-shot effects (Option, Either, Id, Eval, IO, Validated, …) thus pay what a shared array costs (one array plus one small buffer object, no per-element structure), and multi-shot effects pay one prefix copy per extra branch, bounded by the size of the result they build anyway. The claim is a plain field, not a CAS (a CAS measured ~2× slower here): it assumes no single run of G resumes continuations on one intermediate value from two threads at once, which nothing that re-evaluates its inputs (IO, fs2, Kleisli) does.
Attributes
- Source
- PSVec.scala
- Supertypes
- Self type
-
pSVecTraverse.type
Type members
Classlikes
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 Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait PSVec[Nothing]trait IterableOnce[Nothing]class Objecttrait Matchableclass AnyShow all
- Self type
-
Empty.type
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
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
Value members
Concrete methods
Zero-length shared vector.
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
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
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
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
Single-element vector, stored inline (no backing array).
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