-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repeatedly func #78
base: master
Are you sure you want to change the base?
Repeatedly func #78
Conversation
@@ -681,8 +681,8 @@ package object matryoshka { | |||
* | |||
* @group algtrans | |||
*/ | |||
@tailrec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like this to be a function, but the problem is that we need this to be tail recursive.
We could actually rewrite this as a coalgebra, like:
final def repeatedlyƒ[A](f: A => Option[A]): Coalgebra[A \/ ?, A] = f(expr) \/> expr
final def repeatedly[A](f: A => Option[A]): A => A =
_.ana[Nu](repeatedlyƒ(f)).unsafePerformSync
We have some stack-safety tests of Partial
that make me think this works, although no performance promises.
But then maybe we can rewrite stuff to use repeatedlyƒ
instead of repeatedly
, and track partiality through more of the code.
@edmundnoble – thoughts?
@@ -54,6 +54,9 @@ package object patterns { | |||
AlgebraM[M, CoEnv[A, F, ?], B] = | |||
ginterpretM[Id, M, F, A, B](f, φ) | |||
|
|||
def ginterpret[W[_], F[_], A, B](f: A => Id[B], φ: GAlgebra[W, F, B]): GAlgebra[W, CoEnv[A, F, ?], B] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏾
So, Matryoshka has a new definition of |
👍 but Monday after spark summit |
@rabbitonweb Ping. |
repeatedly
returns one more time a function value (instead of being a method).also added
ginterpret