Created
March 17, 2018 23:00
-
-
Save paulp/5a108c6dfb00931bce7fae784fa0e158 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 ttypes { | |
type ->[+A, +B] = (A, B) | |
type PairOf[+A] = A -> A | |
type SumOf[+A] = A \/ A | |
trait Interpret[T[_[_]]] { | |
type ^[Outer[_], Inner[_]] = Outer[T[Inner]] | |
trait Transform[F[_], G[_]] { | |
type FTF = F[T[F]] | |
type GTG = G[T[G]] | |
/** Bottom-up transforms. */ | |
type GAlgebraicM[W[_], M[_]] = F[W ^ G] => M[G ^ G] | |
type AlgebraicM[M[_]] = F ^ G => M[G ^ G] // GAlgebraicM[Id, M] | |
type GAlgebraic[W[_]] = F[W ^ G] => G ^ G // GAlgebraicM[W, Id] | |
type Algebraic = F ^ G => G ^ G // GAlgebraicM[Id, Id] | |
/** Top-down transforms. */ | |
type GCoalgebraicM[N[_], M[_]] = F ^ F => M[G[N ^ F]] | |
type CoalgebraicM[M[_]] = F ^ F => M[G ^ F ] // GCoalgebraicM[Id, M] | |
type GCoalgebraic[N[_]] = F ^ F => G[N ^ F] // GCoalgebraicM[N, Id] | |
type Coalgebraic = F ^ F => G ^ F // GCoalgebraicM[Id, Id] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment