MacrosImpl

class MacrosImpl[Pipe[_, _], In, Out](q: Quotes)(pd: Expr[PipeDerivation[Pipe]], val Pipe: Type[Pipe], val In: Type[In], val Out: Type[Out]) extends PlatformDefinitions[Pipe, In, Out] with PlatformGenerators[Pipe, In, Out]
trait PlatformGenerators[Pipe, In, Out]
trait PlatformSumCaseGeneration[Pipe, In, Out]
trait PlatformProductCaseGeneration[Pipe, In, Out]
trait Generators[Pipe, In, Out]
trait SumCaseGeneration[Pipe, In, Out]
trait ProductCaseGeneration[Pipe, In, Out]
trait PlatformDefinitions[Pipe, In, Out]
trait Definitions[Pipe, In, Out]
class Object
trait Matchable
class Any

Type members

Inherited classlikes

Inherited from:
Definitions
sealed trait ConfigEntry extends Product with Serializable

Possible configuration options that we can work with inside a macro. Parsed from pipez.PipeDerivationConfig

Possible configuration options that we can work with inside a macro. Parsed from pipez.PipeDerivationConfig

Inherited from:
Definitions
Inherited from:
Definitions
sealed trait DerivationError extends Product with Serializable

Possible errors that can happen during derivation

Possible errors that can happen during derivation

Inherited from:
Definitions
Inherited from:
Definitions
sealed trait DerivationResult[+A] extends Product with Serializable

Helper which allows: use of for-comprehension, parallel error composition, logging

Helper which allows: use of for-comprehension, parallel error composition, logging

Inherited from:
Definitions
final case class EnumData[A](elements: List[Case[_ <: A]])

Stores information from what pieces Out is made

Stores information from what pieces Out is made

Inherited from:
SumCaseGeneration
object EnumData
Inherited from:
SumCaseGeneration
final case class EnumGeneratorData(subtypes: ListMap[String, InputSubtype])

Final platform-independent result of matching inputs with outputs using resolved strategies

Final platform-independent result of matching inputs with outputs using resolved strategies

Inherited from:
SumCaseGeneration
Inherited from:
SumCaseGeneration
sealed trait InSubtypeLogic[InSubtype <: In] extends Product with Serializable

Translation strategy for a particular input subtype

Translation strategy for a particular input subtype

Inherited from:
SumCaseGeneration
sealed trait OutFieldLogic[OutField] extends Product with Serializable

Value generation strategy for a particular output parameter/setter

Value generation strategy for a particular output parameter/setter

Inherited from:
ProductCaseGeneration
object Path
Inherited from:
Definitions
sealed trait Path extends Product with Serializable

Type representing how we got the specific value from the in: In argument

Type representing how we got the specific value from the in: In argument

Inherited from:
Definitions
sealed trait ProductGeneratorData extends Product with Serializable

Final platform-independent result of matching inputs with outputs using resolved strategies

Final platform-independent result of matching inputs with outputs using resolved strategies

Inherited from:
ProductCaseGeneration
final case class ProductInData(getters: ListMap[String, Getter[_]])

Stores information how each attribute/getter could be extracted from In value

Stores information how each attribute/getter could be extracted from In value

Inherited from:
ProductCaseGeneration
sealed trait ProductOutData extends Product with Serializable

Stores information how Out value could be constructed from values of constructor parameters/passed to setters

Stores information how Out value could be constructed from values of constructor parameters/passed to setters

Inherited from:
ProductCaseGeneration
final class Settings(entries: List[ConfigEntry])

Collection of config options obtained after parsing pipez.PipeDerivationConfig

Collection of config options obtained after parsing pipez.PipeDerivationConfig

Inherited from:
Definitions

Inherited types

type Constructor = List[List[Expr[Any]]] => Expr[Out]

Should create Out expression from the constructor arguments grouped in parameter lists

Should create Out expression from the constructor arguments grouped in parameter lists

Inherited from:
ProductCaseGeneration
override type Expr[A] = Expr[A]

Platform-specific expression representation (c.universe.Expr[A] in 2, quotes.Expr[A] in 3

Platform-specific expression representation (c.universe.Expr[A] in 2, quotes.Expr[A] in 3

Inherited from:
PlatformDefinitions
type InSubtype <: In
Inherited from:
SumCaseGeneration
override type Type[A] = Type[A]

Platform-specific type representation (c.universe.Type in 2, scala.quoted.Type[A] in 3)

Platform-specific type representation (c.universe.Type in 2, scala.quoted.Type[A] in 3)

Inherited from:
PlatformDefinitions

Value members

Concrete methods

def PipeOf[I : Type, O : Type]: Type[Pipe[I, O]]

Provides Type instance for Pipe[I, O]

Provides Type instance for Pipe[I, O]

Inherited methods

final def areSubtypesEqual[A : Type, B : Type]: Boolean

Check is A =:= B in a platform-independent code

Check is A =:= B in a platform-independent code

Inherited from:
PlatformSumCaseGeneration
final def deriveConfigured(configurationCode: Expr[PipeDerivationConfig[Pipe, In, Out]]): Expr[Pipe[In, Out]]

Derives using Settings parsed from PipeDerivationConfig[Pipe, In, Out] expression

Derives using Settings parsed from PipeDerivationConfig[Pipe, In, Out] expression

Inherited from:
Generators
final def deriveDefault: Expr[Pipe[In, Out]]

Derives using default Settings

Derives using default Settings

Inherited from:
Generators
final def diagnosticsMessage[A](result: DerivationResult[A]): String

Generate message to be displayed by macro on INFO level (if requested by config)

Generate message to be displayed by macro on INFO level (if requested by config)

Inherited from:
Generators
final def errorMessage(errors: List[DerivationError]): String

Generates error message to be returned from macro on ERROR level

Generates error message to be returned from macro on ERROR level

Inherited from:
Generators

Platform-specific way of parsing In data

Platform-specific way of parsing In data

Should:

  • obtain a lift of subtypes OR enumeration values
  • form it into EnumData[In]
Inherited from:
PlatformSumCaseGeneration

Platform-specific way of parsing Out data

Platform-specific way of parsing Out data

Should:

  • obtain a lift of subtypes OR enumeration values
  • form it into EnumData[In]
Inherited from:
PlatformSumCaseGeneration

Platform-specific way of parsing In data

Platform-specific way of parsing In data

Should:

  • obtain all methods which are Scala's getters (vals, nullary defs)
  • obtain all methods which are Java Bean getters (starting with is- or get-)
  • for each create an InField factory which takes In argument and returns InField expression
  • form obtained collection into ProductInData
Inherited from:
PlatformProductCaseGeneration

Platform-specific way of parsing Out data

Platform-specific way of parsing Out data

Should:

  • verify whether output is a case class, a case object or a Java Bean
  • obtain respectively:
    • a constructor taking all arguments
    • expression containing case object value
    • a default constructor and collection of setters respectively
  • form obtained data into ProductOutData
Inherited from:
PlatformProductCaseGeneration
final def generateEnumCode(generatorData: EnumGeneratorData): DerivationResult[Expr[Pipe[In, Out]]]

Platform-specific way of generating code from resolved information

Platform-specific way of generating code from resolved information

For subtype input should generate code like:

pipeDerivation.lift { (in: In, ctx: pipeDerivation.Context) =>
 in match {
   case inSubtype: In.Foo => pipeDerivation.unlift(fooPipe, inSubtype, updateContext(ctx, path))
   case inSubtype: In.Bar => pipeDerivation.unlift(barPipe, inSubtype, updateContext(ctx, path))
 }
}
Inherited from:
PlatformSumCaseGeneration
final def generateProductCode(generatorData: ProductGeneratorData): DerivationResult[Expr[Pipe[In, Out]]]

Platform-specific way of generating code from resolved information

Platform-specific way of generating code from resolved information

For case class output should generate code like:

pipeDerivation.lift { (in: In, ctx: pipeDerivation.Context) =>
 pipeDerivation.mergeResult(
    ctx,
   pipeDerivation.mergeResult(
      ctx,
     pipeDerivation.pure(Array[Any](2)),
     pipeDerivation.unlift(fooPipe, in.foo, pipeDerivation.updateContext(ctx, Path.root.field("foo"))),
     { (left, right) =>
       left(0) = right
       left
      }
   ),
   pipeDerivation.unlift(barPipe, in.bar, pipeDerivation.updateContext(ctx, Path.root.field("bar"))),
   { (left, right) =>
     left(1) = right
     new Out(
       foo = left(0).asInstanceOf[Foo2],
       bar = left(1).asInstanceOf[Bar2],
     )
   }
 )
}

For case object output should generate code like:

pipeDerivation.lift { (in: In, ctx: pipeDerivation.Context) =>
 pipeDerivation.pure(CaseObject)
}

For Java Bean should generate code like:

pipeDerivation.lift { (in: In, ctx: pipeDerivation.Context) =>
 pipeDerivation.mergeResult(
   ctx,
   pipeDerivation.mergeResult(
     ctx,
     pipeDerivation.pure {
       val result = new Out()
       result
     },
     pipeDerivation.unlift(fooPipe, in.foo, pipeDerivation.updateContext(ctx, Path.root.field("foo"))),
     { (left, right) =>
       left.setFoo(right)
       left
     }
   ),
   pipeDerivation.unlift(barPipe, in.bar, pipeDerivation.updateContext(ctx, Path.root.field("bar"))),
   { (left, right) =>
     left.setBar(right)
     left
   }
 )
}
Inherited from:
PlatformProductCaseGeneration
final def isADT[A : Type]: Boolean

True iff A is sealed

True iff A is sealed

Inherited from:
PlatformSumCaseGeneration
final def isCaseClass[A : Type]: Boolean

True iff A is defined as case class, is NOT abstract and has a public constructor

True iff A is defined as case class, is NOT abstract and has a public constructor

Inherited from:
PlatformProductCaseGeneration
final def isCaseObject[A : Type]: Boolean

True iff A is defined as case object, and is public

True iff A is defined as case object, and is public

Inherited from:
PlatformProductCaseGeneration
final def isJavaBean[A : Type]: Boolean

True iff A has a (public) default constructor and at least one (public) method starting with set

True iff A has a (public) default constructor and at least one (public) method starting with set

Inherited from:
PlatformProductCaseGeneration
final def isSubtype[A : Type, B : Type]: Boolean

Check is A <:< B in a platform-independent code

Check is A <:< B in a platform-independent code

Inherited from:
PlatformGenerators
final def isSumType[A : Type]: Boolean
Inherited from:
SumCaseGeneration
final def isTuple[A : Type]: Boolean

True iff A is a tuple

True iff A is a tuple

Inherited from:
PlatformProductCaseGeneration
final def isUsableAsProductOutput: Boolean

Whether Out type could be constructed as "product case"

Whether Out type could be constructed as "product case"

Inherited from:
ProductCaseGeneration
final def isUsableAsSumTypeConversion: Boolean

Whether both In and Out are ADTs/Java Enums

Whether both In and Out are ADTs/Java Enums

Inherited from:
SumCaseGeneration
final def lift[I : Type, O : Type](call: Expr[(I, Context) => Result[O]]): Expr[Pipe[I, O]]

Should generate code pipeDerivation.lift { (in, ctx) => ... }

Should generate code pipeDerivation.lift { (in, ctx) => ... }

Inherited from:
PlatformGenerators
final def mergeResults[A : Type, B : Type, C : Type](ctx: Expr[Context], ra: Expr[Result[A]], rb: Expr[Result[B]], f: Expr[(A, B) => C]): Expr[Result[C]]

Should generate code pipeDerivation.mergeResults(ctx, ra, rb, (a, b) => ...)

Should generate code pipeDerivation.mergeResults(ctx, ra, rb, (a, b) => ...)

Inherited from:
PlatformGenerators
final def pathCode(path: Path): Expr[Path]

Translates Path as seen in macro to runtime value we can pass to updateContext`

Translates Path as seen in macro to runtime value we can pass to updateContext`

Inherited from:
PlatformDefinitions
final def previewCode[A](code: Expr[A]): String

Allows displaying the generated code in platform-independent way

Allows displaying the generated code in platform-independent way

Inherited from:
PlatformDefinitions
final def previewType[A : Type]: String

Prints type value

Prints type value

Inherited from:
PlatformDefinitions
final def pureResult[A : Type](a: Expr[A]): Expr[Result[A]]

Should generate code pipeDerivation.pureResult(a)

Should generate code pipeDerivation.pureResult(a)

Inherited from:
PlatformGenerators
final def readConfig(code: Expr[PipeDerivationConfig[Pipe, In, Out]]): DerivationResult[Settings]

Turns the code defining PipeDerivationConfig[Pipe, In, Out] into Settings.

Turns the code defining PipeDerivationConfig[Pipe, In, Out] into Settings.

Requires that config is created as one chain while passing the parameter.

Inherited from:
PlatformDefinitions
final def readSettingsIfGiven(code: Option[Expr[PipeDerivationConfig[Pipe, In, Out]]]): DerivationResult[Settings]

Reads configs if passed, or fallback to defaults (empty Settings) otherwise

Reads configs if passed, or fallback to defaults (empty Settings) otherwise

Inherited from:
Definitions
final def reportDiagnostics[A](result: DerivationResult[A]): Unit

Should use platform-specific way of reporting information from macro on INFO level

Should use platform-specific way of reporting information from macro on INFO level

Inherited from:
PlatformGenerators
final def reportError(errors: List[DerivationError]): Nothing

Should use platform-specific way of reporting errors from macro

Should use platform-specific way of reporting errors from macro

Inherited from:
PlatformGenerators
def returnType[A](typeRepr: TypeRepr): Type[A]
Inherited from:
PlatformDefinitions
final def singleAbstractMethodExpansion[SAM : Type](code: Expr[SAM]): Expr[SAM]

If we pass Single Abstract Method as argument, after expansion inference sometimes fails, compiler might need a hint

If we pass Single Abstract Method as argument, after expansion inference sometimes fails, compiler might need a hint

Inherited from:
PlatformDefinitions
final def summonPipe[Input : Type, Output : Type]: DerivationResult[Expr[Pipe[Input, Output]]]

Allows summoning the type class in platform-independent way

Allows summoning the type class in platform-independent way

Inherited from:
PlatformDefinitions
def typeOf[A](implicit tpe: Type[A]): Type[A]

Summons Type independently of the platform

Summons Type independently of the platform

Inherited from:
Definitions
final def unlift[I : Type, O : Type](pipe: Expr[Pipe[I, O]], in: Expr[I], ctx: Expr[Context]): Expr[Result[O]]

Should generate code pipeDerivation.unlift(pipe)(in, ctx)

Should generate code pipeDerivation.unlift(pipe)(in, ctx)

Inherited from:
PlatformGenerators
final def updateContext(ctx: Expr[Context], path: Expr[Path]): Expr[Context]

Should generate code pipeDerivation.updateContext(ctx, path)

Should generate code pipeDerivation.updateContext(ctx, path)

Inherited from:
PlatformGenerators

Concrete fields

override val In: Type[In]

Provides Type instance for In

Provides Type instance for In

override val Out: Type[Out]

Provides Type instance for Out

Provides Type instance for Out

override val Pipe: Type[Pipe]
val pipeDerivation: Expr[Aux[Pipe, Context, Result]]

Value of PipeDerivation[Pipe], which was passed to macro as (most likely) implicit

Value of PipeDerivation[Pipe], which was passed to macro as (most likely) implicit

Like previewCode(pipeDerivation) but allowing hiding some shenanigans we do

Like previewCode(pipeDerivation) but allowing hiding some shenanigans we do

Inherited fields

final val resolveConversion: Settings => DerivationResult[Expr[Pipe[In, Out]]]

Takes Settings and passes them to generators, the first which decides it's their case, attempt generation

Takes Settings and passes them to generators, the first which decides it's their case, attempt generation

Inherited from:
Generators

Givens

Inherited givens

given quotes: Quotes
Inherited from:
PlatformDefinitions

Implicits

Implicits

implicit override val Context: Type[Context]
implicit override val Result: Type[Result]