Created
February 5, 2024 06:24
-
-
Save xuwei-k/5032d6e9e8b72eb332413794ba8461d5 to your computer and use it in GitHub Desktop.
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
scalaVersion := "2.13.12" | |
libraryDependencies += "com.chuusai" %% "shapeless" % "2.3.10" |
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
package example | |
import shapeless.nat._ | |
import shapeless.syntax.std.tuple._ | |
object Main{ | |
def main(args: Array[String]): Unit = { | |
val t = (2, false, "a") | |
val x = t.updateAtWith(2)(a => a :: Nil)._2 | |
println(x) | |
assert(x == (2, false, "a" :: Nil)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment