Skip to content

Instantly share code, notes, and snippets.

@LukaJCB
Created October 18, 2017 21:29
Show Gist options
  • Save LukaJCB/1815121a2236b8498ce9a21c0563efa7 to your computer and use it in GitHub Desktop.
Save LukaJCB/1815121a2236b8498ce9a21c0563efa7 to your computer and use it in GitHub Desktop.
@typeclass trait NonEmptyTraverseUnordered[F[_]] {
def nonEmptyTraverseUnordered[G[_]: CommutativeApply, A, B](sa: F[A])(f: A => G[B]): G[F[B]]
def nonEmptySequenceUnordered[G[_]: CommutativeApply, A](fga: F[G[A]]): G[F[A]] =
nonEmptyTraverseUnordered(fga)(identity)
}
@typeclass trait NonEmptyCommutativeParallel[F[_], M[_]] {
def commutativeApply: CommutativeApply[F]
def commutativeFlatMap: CommutativeFlatMap[M]
def sequential: F ~> M
def parallel: M ~> F
}
@typeclass trait CommutativeParallel[F[_], M[_]] extends NonEmptyCommutativeParallel[F, M] {
def commutativeApplicative: CommutativeApplicative[F]
def commutativeMonad: CommutativeMonad[M]
def commutativeApply = commutativeApplicative
def commutativeFlatMap = commutativeMonad
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment