Skip to content

Instantly share code, notes, and snippets.

@tomaszperek
Created October 19, 2015 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomaszperek/6e06f8aa1cf63a54e0c2 to your computer and use it in GitHub Desktop.
Save tomaszperek/6e06f8aa1cf63a54e0c2 to your computer and use it in GitHub Desktop.
Evidence for longer HLists
implicit def hconsIsHListOfM[M[_], H, In <: HList, Out <: HList](
implicit ev: IsHListOfM[M, In, Out], m: Monad[M]
): IsHListOfM[M, M[H] :: In, H :: Out] = new IsHListOfM[M, M[H] :: In, H :: Out] {
override def hsequence(l: M[H] :: In): M[H :: Out] =
l.head.flatMap(h => ev.hsequence(l.tail).map(h :: _))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment