Last active
December 5, 2016 18:43
-
-
Save sir-wabbit/cf1149a342af352a84fc8a86ab240805 to your computer and use it in GitHub Desktop.
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
| object Forall { | |
| trait Forall[F[_]] { def apply[A]: F[A] } | |
| trait Forall2[F[_, _]] { def apply[A, B]: F[A, B] } | |
| type ~>[F[_], G[_]] = Forall[ λ[ A => F[A] => G[A]]] | |
| type ~~>[F[_, _], G[_, _]] = Forall2[λ[(A, B) => F[A, B] => G[A, B]]] | |
| type Id[A] = A | |
| type Hom[F[_], A, B] = F[A] => F[B] | |
| type Prod[F[_], G[_], A, B] = F[(G[A], G[B])] | |
| type Kleisli[F[_], A, B] = A => F[B] | |
| final case class Functor[F[_]] | |
| (map: Hom[Id, ?, ?] ~~> Hom[F, ?, ?]) | |
| final case class Pointed[F[_]] | |
| (map: Hom[Id, ?, ?] ~~> Hom[F, ?, ?], | |
| pure: Id ~> F) | |
| final case class Applicative[F[_]] | |
| (map: Hom[Id, ?, ?] ~~> Hom[F, ?, ?], | |
| pure: Id ~> F, | |
| zip: Prod[Id, F, ?, ?] ~~> Prod[F, Id, ?, ?]) | |
| final case class Monad[F[_]] | |
| (map: Hom[Id, ?, ?] ~~> Hom[F, ?, ?], | |
| pure: Id ~> F, | |
| bind: Kleisli[F, ?, ?] ~~> Hom[F, ?, ?]) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment