From adfab4c9a3447cb57bf48a3730e4edbe8d9a93f5 Mon Sep 17 00:00:00 2001 From: Mohammed Abdulrazeg Date: Sat, 18 Apr 2020 23:17:04 +0100 Subject: [PATCH 1/3] Fix import for futureEitherOr for-comprehension example to work --- src/pages/monad-transformers/index.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/monad-transformers/index.md b/src/pages/monad-transformers/index.md index e9576bcd..f5d03c4f 100644 --- a/src/pages/monad-transformers/index.md +++ b/src/pages/monad-transformers/index.md @@ -326,9 +326,8 @@ cut through three layers of abstraction: ```scala mdoc:silent import cats.instances.future._ // for Monad -import scala.concurrent.Await +import cats.syntax.applicative._ // for pure import scala.concurrent.ExecutionContext.Implicits.global -import scala.concurrent.duration._ ``` ```scala mdoc:silent From 3b70f87efad50c8877d89184fbcad144732b86f0 Mon Sep 17 00:00:00 2001 From: Mohammed Abdulrazeg Date: Sat, 18 Apr 2020 23:26:54 +0100 Subject: [PATCH 2/3] Adding the Await and duration imports where they are needed --- src/pages/monad-transformers/index.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/monad-transformers/index.md b/src/pages/monad-transformers/index.md index f5d03c4f..dae3724e 100644 --- a/src/pages/monad-transformers/index.md +++ b/src/pages/monad-transformers/index.md @@ -398,6 +398,9 @@ For example, to `Await` the `FutureEitherOption` stack above, we need to call `value` twice: ```scala mdoc +import scala.concurrent.Await +import scala.concurrent.duration._ + futureEitherOr val intermediate = futureEitherOr.value From 82a4f0ae9e82201cb47c34f168a924ca5fe2add9 Mon Sep 17 00:00:00 2001 From: Mohammed Abdulrazeg Date: Sat, 18 Apr 2020 23:57:17 +0100 Subject: [PATCH 3/3] Fixed weird formatting for `addAll` and adding missing dep --- src/pages/monad-transformers/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/monad-transformers/index.md b/src/pages/monad-transformers/index.md index dae3724e..64c0acb3 100644 --- a/src/pages/monad-transformers/index.md +++ b/src/pages/monad-transformers/index.md @@ -457,6 +457,7 @@ import cats.data.EitherT import cats.instances.list._ import scala.concurrent.Future ``` + ```scala mdoc:silent sealed abstract class HttpError final case class NotFound(item: String) extends HttpError @@ -492,6 +493,7 @@ def parseNumber(str: String): Logged[Option[Int]] = // Consumers use monad transformers locally to simplify composition: def addAll(a: String, b: String, c: String): Logged[Option[Int]] = { import cats.data.OptionT +import cats.instances.list._ val result = for { a <- OptionT(parseNumber(a))