EnumModule

libretto.lambda.EnumModule
See theEnumModule companion object
trait EnumModule[->[_, _], **[_, _], Enum[_], ||[_, _], ::[_, _]]

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Type members

Classlikes

class HandleInit[Cases]

Attributes

Supertypes
class Object
trait Matchable
class Any
opaque trait HandlersModule

Attributes

Supertypes
class Object
trait Matchable
class Any

Types

type CaseList[Cases]

Witnesses that Cases is a list :: cases, usable in Enum, i.e. that Cases is :: the form (Name1 :: T1) || ... || (NameN :: TN).

Witnesses that Cases is a list :: cases, usable in Enum, i.e. that Cases is :: the form (Name1 :: T1) || ... || (NameN :: TN).

Attributes

type DistF[F[_], Cases] <: { type Out; }
type DistLR[A, Cases] <: { type Out; }
type DistRL[B, Cases] <: { type Out; }
type EnumPartition[Cases, P]
type Handlers[Cases, R]
type IsCaseOf[Label, Cases] <: AnyRef { type Type; }
type Partitioning[Cases] <: Partitioning[->, **, Enum[Cases]] { type Partition = [P] =>> EnumPartition[Cases, P]; }

Value members

Abstract methods

def distF[F[_], Cases](using F: Focus[**, F], ev: DistF[F, Cases]): F[Enum[Cases]] -> Enum[ev.Out]
def distLR[A, Cases](using ev: DistLR[A, Cases]): (A ** Enum[Cases]) -> Enum[ev.Out]
def distRL[B, Cases](using ev: DistRL[B, Cases]): (Enum[Cases] ** B) -> Enum[ev.Out]
def handle[Cases, R](handlers: Handlers[Cases, R]): Enum[Cases] -> R
def inject[Cases](label: String)(using c: IsCaseOf[label.type, Cases]): c.Type -> Enum[Cases]
def partitioning[Cases](using ev: CaseList[Cases]): Partitioning[Cases]
def toPartition[Cases, C](ev: IsCaseOf[C, Cases]): EnumPartition[Cases, ev.Type]

Concrete methods

def extractorOf[T, Cases](p: Partitioning[->, **, T] { type Partition = [P] =>> EnumPartition[Cases, P]; })(label: String)(using ev: IsCaseOf[label.type, Cases]): Extractor[->, **, T, ev.Type]
def handle[ADT](using u: Unapply[ADT, Enum]): HandleInit[u.A]
def make[ADT](using u: Unapply[ADT, Enum])(label: String)(using c: IsCaseOf[label.type, u.A]): c.Type -> ADT
def partition[ADT](using u: Unapply[ADT, Enum], ev: CaseList[u.A]): Partitioning[u.A]

Abstract fields

Givens

Givens

given consCaseList[HLbl <: String, H, Tail](using hLbl: StaticValue[HLbl], t: CaseList[Tail]): CaseList[(HLbl :: H) || Tail]
given distFCons[F[_], Label <: String, H, Tail](using label: StaticValue[Label], tail: DistF[F, Tail]): DistF[F, (Label :: H) || Tail] { type Out = (Label :: F[H]) || tail.Out; }
given distFSingle[F[_], Lbl <: String, A](using label: StaticValue[Lbl]): DistF[F, Lbl :: A] { type Out = Lbl :: F[A]; }
given distLRCons[A, Label <: String, H, Tail](using label: StaticValue[Label], tail: DistLR[A, Tail]): DistLR[A, (Label :: H) || Tail] { type Out = (Label :: (A ** H)) || tail.Out; }
given distLRSingle[A, Label <: String, B](using label: StaticValue[Label]): DistLR[A, Label :: B] { type Out = Label :: (A ** B); }
given isHeadCase[HLbl <: String, H, Tail](using hLbl: StaticValue[HLbl]): IsCaseOf[HLbl, (HLbl :: H) || Tail] { type Type = H; }
given isSingleCase[Lbl <: String, A](using label: StaticValue[Lbl]): IsCaseOf[Lbl, Lbl :: A] { type Type = A; }
given isTailCase[Lbl, HLbl, H, Tail](using j: IsCaseOf[Lbl, Tail]): IsCaseOf[Lbl, (HLbl :: H) || Tail] { type Type = j.Type; }
given singleCaseList[Lbl <: String, A](using label: StaticValue[Lbl]): CaseList[Lbl :: A]

Extensions

Extensions

extension [Cases](p: Partitioning[Cases])
def apply[C](using ev: IsCaseOf[C, Cases]): Extractor[->, **, Enum[Cases], ev.Type]