zio.blocks.schema.comptime.Allows.Sequence
See theSequence companion object
sealed abstract class Sequence[A <: Structural] extends Structural
Matches any sequence type (List, Vector, Set, Array, Chunk, …) whose element type satisfies A.
Use the subtypes in Sequence.List, Sequence.Vector, Sequence.Set, Sequence.Array, and Sequence.Chunk when you need to distinguish a specific collection kind. Each subtype extends Sequence[A], so a grammar written with the parent still accepts all collections.
import zio.blocks.schema.comptime.Allows
import Allows._
// Any collection of primitives:
implicitly[Allows[List[Int], Sequence[Primitive]]]
// Only a Set, not a List:
implicitly[Allows[Set[Int], Sequence.Set[Primitive]]]
// Only a Set, and the element type must be exactly Int:
implicitly[Allows[Set[Int], Sequence.Set[IsType[Int]]]]
Type parameters
- A
-
The constraint that the element type of the sequence must satisfy.
Attributes
- Companion
- object
- Source
- Allows.scala
- Graph
-
- Supertypes
- Known subtypes
In this article