All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.arainko.ducktape.AppliedBuilder.scala Maven / Gradle / Ivy

There is a newer version: 0.2.5
Show newest version
package io.github.arainko.ducktape

import io.github.arainko.ducktape.internal.{ FallibleTransformations, TotalTransformations }

final class AppliedBuilder[Source, Dest] private[ducktape] (value: Source) {
  inline def transform(inline config: Field[Source, Dest] | Case[Source, Dest]*): Dest =
    TotalTransformations.between[Source, Dest](value, "transformation", config*)

  def fallible[F[+x], M <: Mode[F]](using M): AppliedBuilder.Fallible[F, M, Source, Dest] =
    AppliedBuilder.Fallible[F, M, Source, Dest](value)
}

object AppliedBuilder {

  final class Fallible[F[+x], M <: Mode[F], Source, Dest] private[ducktape] (source: Source)(using F: M) {

    inline def transform(
      inline config: Field.Fallible[F, Source, Dest] | Case.Fallible[F, Source, Dest]*
    ): F[Dest] =
      FallibleTransformations.between[F, Source, Dest](source, F, "transformation", config*)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy