The disjoint union of types α
and β
, ordinarily written α ⊕ β
.
An element of α ⊕ β
is either an a : α
wrapped in Sum.inl
or a b : β
wrapped in Sum.inr
.
α ⊕ β
is not equivalent to the set-theoretic union of α
and β
because its values include an
indication of which of the two types was chosen. The union of a singleton set with itself contains
one element, while Unit ⊕ Unit
contains distinct values inl ()
and inr ()
.
Constructors
inl.{u, v} {α : Type u} {β : Type v} (val : α) : α ⊕ β
Left injection into the sum type α ⊕ β
.
inr.{u, v} {α : Type u} {β : Type v} (val : β) : α ⊕ β
Right injection into the sum type α ⊕ β
.