diff --git a/src/core/wisteria.ContextRequirement.scala b/src/core/wisteria.ContextRequirement.scala index e217f9d..a87803a 100644 --- a/src/core/wisteria.ContextRequirement.scala +++ b/src/core/wisteria.ContextRequirement.scala @@ -22,7 +22,7 @@ import vacuous.* import scala.compiletime.* object ContextRequirement: - given required: ContextRequirement with + given ContextRequirement as required: type Optionality[Type] = Type type Required = true def wrap[ValueType](optional: Optional[ValueType]): ValueType = optional.vouch(using Unsafe) diff --git a/src/core/wisteria.Derivation.scala b/src/core/wisteria.Derivation.scala index f89d5f1..baa36dc 100644 --- a/src/core/wisteria.Derivation.scala +++ b/src/core/wisteria.Derivation.scala @@ -24,8 +24,9 @@ import scala.compiletime.* trait Derivation[TypeclassType[_]] extends ProductDerivationMethods[TypeclassType], SumDerivationMethods[TypeclassType]: - inline given derived[DerivationType](using Reflection[DerivationType]) - : TypeclassType[DerivationType] = + inline given [DerivationType](using Reflection[DerivationType]) + => TypeclassType[DerivationType] as derived = + inline summon[Reflection[DerivationType]] match case reflection: ProductReflection[derivationType] => join[derivationType](using reflection).asMatchable match diff --git a/src/core/wisteria.ProductDerivationMethods.scala b/src/core/wisteria.ProductDerivationMethods.scala index 4c51c9e..af6725e 100644 --- a/src/core/wisteria.ProductDerivationMethods.scala +++ b/src/core/wisteria.ProductDerivationMethods.scala @@ -68,10 +68,10 @@ trait ProductDerivationMethods[TypeclassType[_]]: accumulator => [FieldType] => context ?=> bind(accumulator): accumulator2 => - bind(lambda[FieldType](context)): result => + bind(lambda[FieldType](context)): result => pure(result *: accumulator2) - bind(tuple): tuple => + bind(tuple): tuple => pure(reflection.fromProduct(tuple.reverse)) protected transparent inline def contexts[DerivationType <: Product] @@ -145,7 +145,7 @@ trait ProductDerivationMethods[TypeclassType[_]]: IArray.create[ResultType](tuple.size): array => fold[DerivationType, Fields, Labels, Unit](tuple, (), 0): unit => [FieldType] => field => - given typeclass: requirement.Optionality[TypeclassType[FieldType]] = + given requirement.Optionality[TypeclassType[FieldType]] as typeclass = requirement.wrap(context) array(index) = lambda[FieldType](field)