Skip to content

Commit

Permalink
Update Corecursive.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
pakoito authored Sep 15, 2017
1 parent 2b9d9b1 commit 250a0c6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package kategory

interface Corecursive<F, G> {
interface Corecursive<F, G> : Typeclass {
fun embedT(compFG: HK<Nested<F, G>, HK<F, G>>): HK<F, G>

fun <A> ana(a: A, f: Coalgebra<Nested<F, G>, A>, FF: Functor<F>, FG: Functor<G>): HK<F, G> =
hylo(a, { embedT(it) }, f, ComposedFunctor(FF, FG))

fun <M, A> anaM(a: A, f: CoalgebraM<M, Nested<F, G>, A>, AG: Applicative<G>, TF: Traverse<F>, TG: Traverse<G>, MM: Monad<M>): HK<M, HK<F, G>> =
hyloM(a, { MM.pure(embedT(it)) }, f, ComposedTraverse(TF, TG, AG), MM)
}
}

0 comments on commit 250a0c6

Please sign in to comment.