Skip to content

Instantly share code, notes, and snippets.

@manishkkatoch
Created January 1, 2019 17:59
Show Gist options
  • Save manishkkatoch/b0e68f45303ee24a4915a7612a2b8e85 to your computer and use it in GitHub Desktop.
Save manishkkatoch/b0e68f45303ee24a4915a7612a2b8e85 to your computer and use it in GitHub Desktop.
@implicitNotFound(msg = "${PName} not found in ${T}")
trait PropertiesExists[T, PName <: HList, PType]
object PropertiesExists {
implicit def forHNil[T, PName, PType](
implicit head: PropertyExists[T, PName, PType]): PropertiesExists[T, PName :: HNil, PType] =
new PropertiesExists[T, PName :: HNil, PType] {}
implicit def forHList[T, PNameHead, PNameTail <: HList, PTypeForHead, PTypeForTail](
implicit headExists: PropertyExists[T, PNameHead, PTypeForHead],
tailExists: PropertiesExists[T, PNameTail, PTypeForTail])
: PropertiesExists[T, PNameHead :: PNameTail, PTypeForTail] =
new PropertiesExists[T, PNameHead :: PNameTail, PTypeForTail] {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment