Created
September 24, 2016 21:21
-
-
Save rjsvaljean/ba6873dccd2181c1a9a8227ce6b0e7a4 to your computer and use it in GitHub Desktop.
For a given F[_], a type level check that the HList L looks like F[A] :: F[B] :: F[C] :: HNil and fails to compile when it looks like F[A] :: SomeOtherType :: HNil
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
| sealed trait IsDataType[F[_], L <: HList] | |
| object IsDataType { | |
| implicit def hnil[F[_]]: IsDataType[F, HNil] = new IsDataType[F, HNil] {} | |
| implicit def rest[F[_], H, T <: HList : ({type l[a] = IsDataType[F, a]})#l]: IsDataType[F, ::[F[H], T]] = | |
| new IsDataType[F, F[H] :: T] {} | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment