17.代数的構造デザインパターン• 半群 (semigroup)• モノイド (monoid)• 群 (group)結合律律 (associative law)• 可換半群• 可換モノイド• 可換群(アーベル群)可換律律 (commutative law)• 環 (ring)• 体 (field)分配律律 (distributive law)(a + b) + c = a + (b + c)a + b = b + aa * (b + c) = a * b + a * c
21.モナド• 計算機科学におけるモナド(Monads)とは、計算機科学者のEugenio Moggiによって提案されたモジュール性を持たせた表⽰示的意味論論の枠組みを⾔言う。プログラムとはクライスリ圏の射である(a program is an arrow of a Kleisli category)、という要請から合成規則としてクライスリトリプル(Kleislitriple)というモナドと等価なものが⽤用いられる。(Wikipedia)• In functional programming, a monad is a structure thatrepresents computations defined as sequences of steps: atype with a monad structure defines what it means tochain operations, or nest functions of that type together.This allows the programmer to build pipelines thatprocess data in steps, in which each action is decoratedwith additional processing rules provided by the monad.(Wikipedia)• ⾮非常に難しい概念念• 使うのは(慣れれば)それほど難しくない• モダンな関数型プログラミングの中核概念念
30.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で実現