Skip to content

Instantly share code, notes, and snippets.

@julienrf
Last active December 11, 2015 18:48
Show Gist options
  • Select an option

  • Save julienrf/4644155 to your computer and use it in GitHub Desktop.

Select an option

Save julienrf/4644155 to your computer and use it in GitHub Desktop.
/**
* data (f :+: g) a = Inl (f a) | Inr (g a)
*/
sealed trait Coproduct[F[+_], G[+_], A]
case class Inl[F[+_], G[+_], A](a: F[A]) extends Coproduct[F, G, A]
case class Inr[F[+_], G[+_], A](a: G[A]) extends Coproduct[F, G, A]
trait :+:[F[+_], G[+_]] {
type Apply[A] = Coproduct[F, G, A]
}
// --- Example of usage
// How to get rid of the `#Apply` thing?
val foo: (List :+: Option)#Apply[Int] = ???
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment