From 2bfaaac76b6d7f171abadb4333a1efc19b4624cd Mon Sep 17 00:00:00 2001 From: Jisoo Park Date: Thu, 27 Oct 2016 14:46:25 +0900 Subject: [PATCH] Remove `defaultTailRecM` from monad doc --- docs/src/main/tut/typeclasses/monad.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/src/main/tut/typeclasses/monad.md b/docs/src/main/tut/typeclasses/monad.md index 73f6a52053..32c2a5e405 100644 --- a/docs/src/main/tut/typeclasses/monad.md +++ b/docs/src/main/tut/typeclasses/monad.md @@ -136,8 +136,14 @@ implicit def optionTMonad[F[_]](implicit F : Monad[F]) = { case Some(a) => f(a).value } } + def tailRecM[A, B](a: A)(f: A => OptionT[F, Either[A, B]]): OptionT[F, B] = - defaultTailRecM(a)(f) + OptionT { + F.tailRecM(a)(a0 => F.map(f(a0).value) { + case None => Either.right[A, Option[B]](None) + case Some(b0) => b0.map(Some(_)) + }) + } } } ```