Is a collection with flatMap a monad?

后端 未结 5 683
独厮守ぢ
独厮守ぢ 2021-02-07 15:30

Scala has the trait Iterable[A] that defines

def flatMap[B](f: (A) ⇒ GenTraversableOnce[B]): Iterable[B] 

That certainly looks

5条回答
  •  北海茫月
    2021-02-07 15:42

    Scala collection methods flatMap and flatten are more powerful than monadic flatMap/flatten. See here: https://www.slideshare.net/pjschwarz/scala-collection-methods-flatmap-and-flatten-are-more-powerful-than-monadic-flatmap-and-flatten

提交回复
热议问题