Skip to content

Commit

Permalink
Merge pull request #340 from takapi327/refactor/2024-12-Fixed-Encoder…
Browse files Browse the repository at this point in the history
…-infer-error-message

Fixed Encoder fold use summonAll
  • Loading branch information
takapi327 authored Dec 18, 2024
2 parents 96f4c06 + bc4ac05 commit d0601a0
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 d0601a0

Please sign in to comment.