diff --git a/modules/core/src/main/scala/io/taig/enumeration/ext/Mapping.scala b/modules/core/src/main/scala/io/taig/enumeration/ext/Mapping.scala index 08b27cf..daa99be 100644 --- a/modules/core/src/main/scala/io/taig/enumeration/ext/Mapping.scala +++ b/modules/core/src/main/scala/io/taig/enumeration/ext/Mapping.scala @@ -10,8 +10,15 @@ import cats.syntax.all.* import scala.annotation.targetName sealed abstract class Mapping[A, B] extends Inject[A, B]: + self => + def values: NonEmptyList[A] + final def imap[T](f: A => T)(g: T => A): Mapping[T, B] = new Mapping[T, B]: + override def values: NonEmptyList[T] = self.values.map(f) + override def inj: T => B = g.andThen(self.inj) + override def prj: B => Option[T] = self.prj(_).map(f) + final def product[C](mapping: Mapping[C, B])( merge: (B, B) => B, split: B => Option[(B, B)]