Scalaz• https://github.com/scalaz/scalaz• キャッチフレーズ• 昔: Scalaz: Type Classes and Pure Functional DataStructures for Scala• 今: An extension to the core Scala library for functionalprogramming. http://typelevel.org• 最新の関数型プログラミングを可能にする機能群をScala向けに⽤用意• 型クラス• 純粋関数型データ構造• Haskellで実績のある機能群をScalaで実現
8.
Pipelineプログラミング(1)def pipeline(x: Int)= h(g(f(x))def pipeline(x: Option[Int]) = x.map(f).map(g).map(h)def pipeline(x: Int) = x |> f |> g |> h関数呼び出しFunctorMonaddef pipeline(x: Option[Int]) = x.flatMap(f).flatMap(g).flatMap(h)def pipeline(x: Option[Int]) =for (a <- f(x); b <- g(a); c <- h(b)) yiled c