Skip to content
Discussion options

You must be logged in to vote

I haven't tried tackling such case, but there is one thing that might potentially help handling it:

val transformationInProcess = foo.into[Bar]
  .withFieldRenamed(_.a1, _.a2)

transformationInProcess
  .withFieldConst(_.a2, value)
  .transform

transformationInProcess
  .withFieldComputed(_.a2, foo => ...)
  .transform

The chaining, at the same time:

  • computes some phantom types that carry information how we are customizing transformation
  • appends values ("consts" and "computed") in the runtime to some Vector

so splitting the transformation into parts is possible, as long as the type-level config is preserved.

I guess such a refactoring as what you think about might be more tricky, but I…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by nrinaudo
Comment options

You must be logged in to vote
2 replies
@MateuszKubuszok
Comment options

@nrinaudo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants