From 0b760661018d424ccbfaabc1da2b2db96b088594 Mon Sep 17 00:00:00 2001 From: csgn Date: Tue, 3 Sep 2024 19:17:49 +0300 Subject: [PATCH] [REFACTOR]: Monad extends FlatMap too --- src/main/scala/kuram/monad/Monad.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/scala/kuram/monad/Monad.scala b/src/main/scala/kuram/monad/Monad.scala index be9cb0f..0f07a9d 100644 --- a/src/main/scala/kuram/monad/Monad.scala +++ b/src/main/scala/kuram/monad/Monad.scala @@ -23,6 +23,7 @@ package kuram package monad import applicative.Applicative +import flatmap.FlatMap /** * @@ -35,10 +36,8 @@ import applicative.Applicative * res0: List[Int] = List(3, 4, 5) * }}} */ -trait Monad[F[_]] extends Applicative[F] { +trait Monad[F[_]] extends Applicative[F] with FlatMap[F] { extension [A](fa: F[A]) { - def flatMap[B](f: A => F[B]): F[B] - override def map[B](f: A => B): F[B] = fa.flatMap(a => pure(f(a)))