Skip to content

Derivation helpers (K0 summon + polymorphic mapElems) #57

@halotukozak

Description

@halotukozak

Reduce boilerplate for derivation typeclasses building on top of Made.

Possible additions (TBD)

K0 summon helper

inline def summonElemInstances[M <: Made, F[_]]: Tuple.Map[M#ElemTypes, F]

Eliminates Tuple.Map[Elems, ExtractOf] + summonAll[F] boilerplate.

Polymorphic mapElems / foldElems

def mapElems[G[_]](f: [t] => (elem: MadeFieldElem.Of[t]) => G[t]): Tuple.Map[ElemTypes, G]

Fundamental derivation primitive — without it every consumer rolls own tuple iteration.

K1 / HKT (out of scope?)

Shapeless 3-style K1 derivation pattern for F[_] typeclasses — likely separate scope, larger
investment, may not fit Made's "enriched Mirror" framing.

Why deferred

  • Made stays "enriched Mirror", not "derivation framework" — helpers can be added without breaking
  • Polymorphic function ergonomics in Scala 3 still have gotchas
  • Concrete consumer (chimney / circe-style typeclass derivation on Made) would shape the API

Revisit when first downstream typeclass derivation crystallizes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions