final class CoproductOps[C <: Coproduct] extends AnyVal with Serializable
Carrier for Coproduct
operations.
These methods are implemented here and extended onto the minimal Coproduct
types to avoid issues that would
otherwise be caused by the covariance of :+:[H, T]
.
- Alphabetic
- By Inheritance
- CoproductOps
- Serializable
- Serializable
- AnyVal
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new CoproductOps(c: C)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
def
adjoined(implicit adjoin: Adjoin[C]): ops.adjoin.Adjoin.Out
Adjoins the elements of this
Coproduct
by flattening anyCoproduct
elements. -
def
align[K <: Coproduct](k: K)(implicit align: Align[C, K]): K
Permutes this
Coproduct
into the same order as anotherCoproduct
.Permutes this
Coproduct
into the same order as anotherCoproduct
. Available only if bothCoproduct
s have elements of the same types. -
def
align[K <: Coproduct](implicit align: Align[C, K]): K
Permutes this
Coproduct
into the same order as anotherCoproduct
.Permutes this
Coproduct
into the same order as anotherCoproduct
. An explicit type argument must be supplied. Available only if bothCoproduct
s have elements of the same types. -
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
at(n: Nat)(implicit at: At[C, N]): Option[A]
Returns the nth element of this
Coproduct
.Returns the nth element of this
Coproduct
. Available only if there is evidence that thisCoproduct
has at least n elements. -
def
at[N <: Nat](implicit at: At[C, N]): Option[A]
Returns the nth element of this
Coproduct
.Returns the nth element of this
Coproduct
. An explicit type must be provided. Available only if there is evidence that thisCoproduct
has at least n elements. - val c: C
-
def
deembed[Sub <: Coproduct](implicit basis: Basis[C, Sub]): Out
De-embeds a sub-
Coproduct
from thisCoproduct
if possible. -
def
drop(n: Nat)(implicit drop: Drop[C, N]): Out
Drops the first
n
elements of thisCoproduct
.Drops the first
n
elements of thisCoproduct
. Available only if there is evidence that thisCoproduct
has at least n elements. -
def
drop[N <: Nat](implicit drop: Drop[C, N]): Out
Drops the first
n
elements of thisCoproduct
.Drops the first
n
elements of thisCoproduct
. An explicit type argument must be provided. Available only if there is evidence that thisCoproduct
has at least n elements. -
def
embed[Super <: Coproduct](implicit basis: Basis[Super, C]): Super
Embeds this
Coproduct
into a "bigger"Coproduct
if possible.Embeds this
Coproduct
into a "bigger"Coproduct
if possible.For instance,
Int :+: String :+: CNil
can be embedded inInt :+: Bool :+: String :+: CNil
. -
def
extendLeft[T]: :+:[T, C]
Extend this
Coproduct
on the left. -
def
extendLeftBy[K <: Coproduct](implicit extendLeftBy: ExtendLeftBy[K, C]): Out
Extend this
Coproduct
on the left. -
def
extendRight[T](implicit extendRight: ExtendRight[C, T]): Out
Extend this
Coproduct
on the right. -
def
extendRightBy[K <: Coproduct](implicit extendRightBy: ExtendRightBy[C, K]): Out
Extend this
Coproduct
on the right. -
def
filter[U](implicit partition: Partition[C, U]): Option[Prefix]
Returns all elements of type
U
of thisCoproduct
.Returns all elements of type
U
of thisCoproduct
. An explicit type argument must be provided. -
def
filterNot[U](implicit partition: Partition[C, U]): Option[Suffix]
Returns all elements of type different than
U
of thisCoproduct
.Returns all elements of type different than
U
of thisCoproduct
. An explicit type argument must be provided. -
def
flatMap(op: Poly)(implicit flatMap: FlatMap[C, op.type]): Out
Flatmaps a higher rank function across this
Coproduct
. -
def
fold(f: Poly)(implicit folder: Folder[f.type, C]): ops.coproduct.Folder.Out
Computes a fold over this
Coproduct
using the higher ranked functionf
.Computes a fold over this
Coproduct
using the higher ranked functionf
. Available only if there is evidencef
can be applied all the elements of thisCoproduct
. -
def
foldLeft[In](z: In)(op: Poly)(implicit folder: LeftFolder[C, In, op.type]): ops.coproduct.LeftFolder.Out
Computes a left fold over this
Coproduct
using the polymorphic binary combining operatorop
. -
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
def
head(implicit cc: IsCCons[C]): Option[H]
Returns the head of this
Coproduct
-
def
init(implicit il: InitLast[C]): Option[I]
Returns all elements except the last
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
last(implicit il: InitLast[C]): Option[L]
Returns the last element of this 'Coproduct'
-
def
length(implicit length: Length[C]): Out
Compute the length of this
Coproduct
. -
def
map(f: Poly)(implicit mapper: Mapper[f.type, C]): Out
Maps a higher rank function across this
Coproduct
. - def partition[U](implicit partition: Partition[C, U]): Either[Prefix, Suffix]
- def partitionC[U](implicit partition: Partition[C, U]): :+:[Prefix, :+:[Suffix, CNil]]
-
def
removeElem[U](implicit remove: Remove[C, U]): Either[U, Rest]
Returns the first element of type
U
of thisCoproduct
plus the remainder of theCoproduct
.Returns the first element of type
U
of thisCoproduct
plus the remainder of theCoproduct
. An explicit type argument must be provided. Available only if there is evidence that thisCoproduct
has an element of typeU
. -
def
removeElemC[U](implicit remove: Remove[C, U]): :+:[U, Rest]
Returns the first element of type
U
of thisCoproduct
plus the remainder of theCoproduct
.Returns the first element of type
U
of thisCoproduct
plus the remainder of theCoproduct
. An explicit type argument must be provided. Available only if there is evidence that thisCoproduct
has an element of typeU
. -
def
reverse(implicit reverse: Reverse[C]): Out
Reverses this
Coproduct
. -
def
rotateLeft(n: Nat)(implicit rotateLeft: RotateLeft[C, N]): Out
Rotate this 'Coproduct' left by
n
-
def
rotateLeft[N <: Nat](implicit rotateLeft: RotateLeft[C, N]): Out
Rotate this 'Coproduct' left by N.
Rotate this 'Coproduct' left by N. An explicit type argument must be provided.
-
def
rotateRight(n: Nat)(implicit rotateRight: RotateRight[C, N]): Out
Rotate this 'Coproduct' right by
n
-
def
rotateRight[N <: Nat](implicit rotateRight: RotateRight[C, N]): Out
Rotate this 'Coproduct' right by N.
Rotate this 'Coproduct' right by N. An explicit type argument must be provided.
-
def
select[T](implicit selector: Selector[C, T]): Option[T]
Returns the first element of type
U
of thisCoproduct
.Returns the first element of type
U
of thisCoproduct
. An explicit type argument must be provided. Available only if there is evidence that thisCoproduct
has an element of typeU
. -
def
split(n: Nat)(implicit split: Split[C, N]): Out
Splits this
Coproduct
at the nth element, returning the prefix and suffix as a pair.Splits this
Coproduct
at the nth element, returning the prefix and suffix as a pair. Available only if there is evidence that thisCoproduct
has at least n elements. -
def
split[N <: Nat](implicit split: Split[C, N]): Out
Splits this
Coproduct
at the nth element, returning the prefix and suffix as a pair.Splits this
Coproduct
at the nth element, returning the prefix and suffix as a pair. An explicit type argument must be provided. Available only if there is evidence that thisCoproduct
has at least n elements. - def splitC(n: Nat)(implicit split: Split[C, N]): :+:[Left, :+:[Right, CNil]]
- def splitC[N <: Nat](implicit split: Split[C, N]): :+:[Left, :+:[Right, CNil]]
-
def
tail(implicit cc: IsCCons[C]): Option[T]
Returns the tail of this
Coproduct
-
def
take(n: Nat)(implicit take: Take[C, N]): Out
Takes the first
n
elements of thisCoproduct
.Takes the first
n
elements of thisCoproduct
. Available only if there is evidence that thisCoproduct
has at least n elements. -
def
take[N <: Nat](implicit take: Take[C, N]): Out
Takes the first
n
elements of thisCoproduct
.Takes the first
n
elements of thisCoproduct
. An explicit type argument must be provided. Available only if there is evidence that thisCoproduct
has at least n elements. -
def
toEither(implicit coproductToEither: CoproductToEither[C]): ops.coproduct.CoproductToEither.Out
Embeds this
Coproduct
into anEither
-
def
toString(): String
- Definition Classes
- Any
-
def
unify(implicit unifier: Unifier[C]): ops.coproduct.Unifier.Out
Returns the value of this
Coproduct
, typed as the least upper bound of thisCoproduct
elements' types -
def
zipConst[Z](z: Z)(implicit zipConst: ZipConst[Z, C]): Out
Zips this
Coproduct
with the given constant, resulting in aCoproduct
of tuples of the form ({element from thisCoproduct
}, {supplied constant}) -
def
zipWith[H <: HList](h: H)(implicit zipWith: ZipWith[H, C]): Out
Zips this
Coproduct
with the providedHList
, resulting in aCoproduct
of tuples of the form ({element from thisCoproduct
}, {element from inputHList
}). -
def
zipWithIndex(implicit zipper: ZipWithIndex[C]): Out
Zips this
Coproduct
with its element indices, resulting in aCoproduct
of tuples of the form ({element from input tuple}, {element index}) -
def
zipWithKeys[K <: HList](implicit zipWithKeys: ZipWithKeys[K, C]): Out
Converts this
Coproduct
of values into a union with given keys.Converts this
Coproduct
of values into a union with given keys. A type argument must be provided. -
def
zipWithKeys[K <: HList](keys: K)(implicit zipWithKeys: ZipWithKeys[K, C]): Out
Converts this
Coproduct
of values into a union with the provided keys.