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] = ItemList[||, ::, Cases]

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

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

Attributes

type DistF[F[_], Cases] = distr.DistF[F, Cases]
type DistLR[A, Cases] = distr.DistF[[x] =>> A ** x, Cases]
type DistRL[B, Cases] = distr.DistF[**, Cases]
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: distr.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[Lbl, Cases](c: IsCaseOf[Lbl, Cases]): c.Type -> Enum[Cases]
def isLastCase[Init, Lbl <: String, Z](label: Lbl): IsCaseOf[Lbl, Init || (Lbl :: Z)] { type Type = Z; }
def isSingleCase[Lbl <: String, A](label: Lbl): IsCaseOf[Lbl, Lbl :: A] { type Type = A; }
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 inject[Cases](label: String)(using c: IsCaseOf[label.type, Cases]): c.Type -> Enum[Cases]
def make[ADT](using u: Unapply[ADT, Enum])(label: String)(using c: IsCaseOf[label.type, u.A]): c.Type -> ADT
def nmap[As, Bs](fs: Named[||, ::, ->, As, Bs]): Enum[As] -> Enum[Bs]
def partition[ADT](using u: Unapply[ADT, Enum], ev: CaseList[u.A]): Partitioning[u.A]

Abstract fields

val distr: DistributionNAry[->, **, Enum, ||, ::]

Givens

Givens

given distFSingle[F[_], Lbl <: String, A](using label: StaticValue[Lbl]): distr.DistF[F, Lbl :: A] { type Out = Lbl :: F[A]; }
given distFSnoc[F[_], Init, Label <: String, Z](using init: distr.DistF[F, Init], label: StaticValue[Label]): distr.DistF[F, Init || (Label :: Z)] { type Out = init.Out || (Label :: F[Z]); }
given isInitCase[Lbl, Init, ZLbl, Z](using j: IsCaseOf[Lbl, Init]): IsCaseOf[Lbl, Init || (ZLbl :: Z)] { type Type = j.Type; }
given isLastCase[Init, Lbl <: String, Z](using label: StaticValue[Lbl]): IsCaseOf[Lbl, Init || (Lbl :: Z)] { type Type = Z; }
given isSingleCase[Lbl <: String, A](using label: StaticValue[Lbl]): IsCaseOf[Lbl, Lbl :: A] { type Type = A; }

Extensions

Extensions

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