From 5e8dbdb781f88b31f347876da5898b78663feccd Mon Sep 17 00:00:00 2001 From: Jacob Wang Date: Thu, 15 Jul 2021 23:36:44 +0100 Subject: [PATCH] Expose SealedTrait.Subtype constructor fields In some usecases, the typeclass instance of a subtype can be modified, so it is useful to allow library authors to recreate the Subtype. --- src/core/interface.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/interface.scala b/src/core/interface.scala index 161caaf8..7268450c 100644 --- a/src/core/interface.scala +++ b/src/core/interface.scala @@ -85,10 +85,10 @@ object SealedTrait: val annotations: IArray[Any], val typeAnnotations: IArray[Any], val isObject: Boolean, - index: Int, - callByNeed: CallByNeed[Typeclass[SType]], - isType: Type => Boolean, - asType: Type => SType & Type + val index: Int, + val callByNeed: CallByNeed[Typeclass[SType]], + val isType: Type => Boolean, + val asType: Type => SType & Type ) extends PartialFunction[Type, SType & Type], Serializable: def typeclass: Typeclass[SType & Type] = callByNeed.value.asInstanceOf[Typeclass[SType & Type]] def cast: PartialFunction[Type, SType & Type] = this @@ -109,4 +109,4 @@ final class CallByNeed[+A](private[this] var eval: () => A) extends Serializable lazy val value: A = val result = eval() eval = null - result \ No newline at end of file + result