withDefault

halotukozak.alpaca.internal.withDefault
See thewithDefault companion object
final infix class withDefault[Provided, Fallback]

Emulates a default type argument, which Scala 3 doesn't have.

lexer and Parser take a using Ctx withDefault D clause, so lexer { ... } and extends Parser without a type argument infer Ctx = D, while an explicit [MyCtx] keeps MyCtx. The given is always found by the compiler; this is an implementation detail and never needs to be written or provided by users.

Type parameters

Fallback

the default type

Provided

the provided type

Attributes

Companion
object
Source
WithDefault.scala
Graph
Supertypes
class Object
trait Matchable
class Any
In this article