Function composition different behaviour of andThen and compose

I’m currently going through Scala with Cats and enjoying it a lot. In Exercise 4.1.2 (Getting Func-y) we are tasked to implement map using the methods pure and flatMap only. The code for reference: import scala.language.higherKinds trait Monad[F[_]] { def pure[A](a: A): F[A] def flatMap[A, B](value: F[A])(func: A => F[B]): F[B] def map[A, B](value: F[A])(func:… Read More Function composition different behaviour of andThen and compose