Why is there no >>> semigroup in Scalaz for A => M [A]?

This is a continuation of my previous question.

Kleislidefines two operators <=<(compose) and >=>(andThen). >=>It looks very natural to me, and I don’t understand how it <=<can be useful.

Moreover, it seems that there is no >=>semigroup for A => M[A], but the semigroup <=<exists.

What is the reason for this?

+4
source share
1 answer

compose(or <=<) is a little more natural when translating between styles without dots and without dots. For example, if we have these functions:

val f: Int => Int = _ + 1
val g: Int => Int = _ * 10

We obtain the following equivalences:

scala> (f andThen g)(3) == g(f(3))
res0: Boolean = true

scala> (f compose g)(3) == f(g(3))
res1: Boolean = true

compose f g .

, Scala andThen ( >=>) , , , , compose. , , Scala . Scala ( , ) .

+7

All Articles