Created
March 16, 2022 16:38
-
-
Save valdo404/a073b9d122c62ce8eb3265bd0513e923 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import shapeless._ | |
import shapeless.record._ | |
import shapeless.labelled._ | |
import shapeless.syntax.singleton._ | |
type BookRecord = FieldType[Witness.`"author"`.T, String] :: | |
FieldType[Witness.`"title"`.T, String] :: | |
FieldType[Witness.`"id"`.T, Double] :: | |
FieldType[Witness.`"price"`.T, Double] :: | |
HNil | |
val book: BookRecord = ("author" ->> "test") :: | |
("title" ->> "test2") :: | |
("id" ->> 1.0) :: | |
("price" ->> 2.0) :: | |
HNil | |
println(book("author")) | |
println(book("title")) | |
println(book("id")) | |
println(book("price")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment