Skip to content

Commit

Permalink
Fixed Encoder fold use summonAll
Browse files Browse the repository at this point in the history
  • Loading branch information
takapi327 committed Dec 18, 2024
1 parent 96f4c06 commit bc4ac05
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions module/ldbc-dsl/src/main/scala/ldbc/dsl/codec/Encoder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,4 @@ object Encoder:
case h *: EmptyTuple => Encoder[h] *: EmptyTuple
case h *: t => Encoder[h] *: MapToTuple[t]

inline def infer[T]: Encoder[T] =
summonFrom[Encoder[T]] {
case parameter: Encoder[T] => parameter
case _ => error("Parameter cannot be inferred")
}

inline def fold[T]: MapToTuple[T] =
inline erasedValue[T] match
case _: EmptyTuple => EmptyTuple
case _: (h *: EmptyTuple) => infer[h] *: EmptyTuple
case _: (h *: t) => infer[h] *: fold[t]
inline def fold[T]: MapToTuple[T] = summonAll[MapToTuple[T]]

0 comments on commit bc4ac05

Please sign in to comment.