Created
March 14, 2019 20:40
-
-
Save qingwei91/b1b5bebdf28e5132343f00af12d6e054 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
| type HAlgebra[F[_[_], _], G[_]] = F[G, ?] ~> G | |
| def hCata[F[_[_], _], G[_], I](alg: HAlgebra[F, G],hfix: HFix[F, I])(implicit F: HFunctor[F]): G[I] = { | |
| val inner = hfix.unfix | |
| val nt = F.hmap( | |
| new (HFix[F, ?] ~> G) { | |
| def apply[A](fa: HFix[F, A]): G[A] = hCata(alg, fa) | |
| } | |
| )(inner) | |
| alg(nt) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment