traitAsOptions[T] extends DepFn0 with Serializable
Provides default values of case class-like types, as a HList of options.
Unlike Default, Out is made of elements like Option[...] instead of None.type and Some[...].
Thus, the availability of default values cannot be checked through types, only through values (via the apply
method).
This representation can be more convenient to deal with when one only check the default values at run-time.
Method apply provides the HList of default values, typed as Out.
Example
caseclass CC(i: Int, s: String = "b")
val default = Default.AsOptions[CC]
// default.Out is Option[Int] :: Option[String] :: HNil// default() returns// None :: Some("b") :: HNil// typed as default.Out
Provides default values of case class-like types, as a HList of options.
Unlike
Default
,Out
is made of elements likeOption[...]
instead ofNone.type
andSome[...]
. Thus, the availability of default values cannot be checked through types, only through values (via theapply
method).This representation can be more convenient to deal with when one only check the default values at run-time.
Method
apply
provides the HList of default values, typed asOut
.Example