Skip to content

Instantly share code, notes, and snippets.

@fommil
Created November 14, 2017 22:24
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 fommil/0b5f73dc9b3821cbc9b5fb1201f077c9 to your computer and use it in GitHub Desktop.
Save fommil/0b5f73dc9b3821cbc9b5fb1201f077c9 to your computer and use it in GitHub Desktop.
// Copyright: 2017 Sam Halliday
// License: http://www.gnu.org/licenses/gpl.html
package scalaz
import scala.Option
import Scalaz._
sealed abstract class /~\[F[_], C[_]] {
type T
def value: C[T]
def tc: F[T]
}
object /~\ {
type Aux[F[_], C[_], A] = /~\[F, C] { type T = A }
def unapply[F[_], C[_]](p: F /~\ C): Option[(F[p.T], C[p.T])] =
scala.Predef.???
def apply[F[_], A](a: A, fa: => F[A]): Aux[F, Id, A] = new /~\[F, Id] {
type T = A
def value: A = a
def tc: F[A] = fa
}
type T2[A] = (A, A)
def apply[F[_], A](a1: A, a2: A, fa: => F[A]): Aux[F, T2, A] =
new /~\[F, T2] {
type T = A
def value: (A, A) = (a1, a2)
def tc: F[A] = fa
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment