Last active
October 9, 2024 18:08
-
-
Save dacr/01df233da9014dd45e7af15ceac83ce8 to your computer and use it in GitHub Desktop.
chimney simplest usage example / published by https://github.com/dacr/code-examples-manager #d518a36f-c696-46b2-b777-14af2a19a562/b9b69de50e5d56aa422ec59abe6641f6732ec0f4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// summary : chimney simplest usage example | |
// keywords : scala, chimney, @testable | |
// publish : gist | |
// authors : chimney | |
// license : Apache2 | |
// id : d518a36f-c696-46b2-b777-14af2a19a562 | |
// created-on : 2023-06-23T16:20:02+02:00 | |
// managed-by : https://github.com/dacr/code-examples-manager | |
// run-with : scala-cli $file | |
//> using scala "3.5.1" | |
//> using dep "io.scalaland::chimney:1.5.0" | |
//> using dep com.lihaoyi::pprint::0.9.0 | |
import io.scalaland.chimney.dsl.* | |
import pprint.* | |
case class Foo(x: String, y: Int, z: Boolean = true) | |
case class Bar(x: String, y: Int) | |
pprintln(Foo("abc", 10).transformInto[Bar]) | |
pprintln(Bar("abc", 10).into[Foo].enableDefaultValues.transform) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment