Last active
June 29, 2017 09:13
-
-
Save wfaler/bb254253f7bb0ed1b9fffb97a3ff582c to your computer and use it in GitHub Desktop.
Finding out type of prepend.Out
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
case class Record[A](userId: UUID, createdAt: LocalDateTime, version: Long, data: A) | |
type MetaData = UUID :: LocalDateTime :: Long :: HNil | |
def length[R <: HList](record: Record[A]) | |
(implicit gen: Generic.Aux[A, R], | |
prepend: Prepend[R, MetaData]) = { | |
val data = gen.to(record.data) | |
val meta = record.userId :: record.createdAt :: record.version :: HNil | |
val toWrite = data ::: meta | |
// next line fails, missing Length[prepend.Out], but prepend.Out cannot be used in the implicit arg list. | |
// What should be an alternate, but valid type signature of prepend.Out? | |
val natLen = toWrite.length | |
// Not gotten here, but probably yet another signature issue in waiting. | |
Nat.toInt(natLen) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment