第 iv 页 目录 Haskell 趣学指南
第十一章 Functors, Applicative Functors 与 Monoids 243
§11.1 温习 Functors . . . . . . . . . . . . . . . . . . . . . . . . . . 243
§11.2 Applicative functors . . . . . . . . . . . . . . . . . . . . . . . 257
§11.3 关键字 “newtype” . . . . . . . . . . . . . . . . . . . . . . . . 277
11.3.1 Using newtype to make type class instances . . . . . . 280
11.3.2 On newtype laziness . . . . . . . . . . . . . . . . . . . 282
11.3.3 type vs newtype vs data . . . . . . . . . . . . . . . . . 284
§11.4 Monoids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
11.4.1 Lists are monoids . . . . . . . . . . . . . . . . . . . . . 289
11.4.2 Product and Sum . . . . . . . . . . . . . . . . . . . . . 290
11.4.3 Any and ALL . . . . . . . . . . . . . . . . . . . . . . . 292
11.4.4 The Ordering monoid . . . . . . . . . . . . . . . . . . 293
11.4.5 Maybe the monoid . . . . . . . . . . . . . . . . . . . . 297
11.4.6 Using monoids to fold data structures . . . . . . . . . 299
第十二章 来看看几种 Monad 304
§12.1 动手做做看: Maybe Monad . . . . . . . . . . . . . . . . . . . 306
§12.2 Monad type class . . . . . . . . . . . . . . . . . . . . . . . . 309
§12.3 走钢索 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
§12.4 do 表示法 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
§12.5 List Monad . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
12.5.1 A knight’s quest . . . . . . . . . . . . . . . . . . . . . 333
§12.6 Monad laws (单子律) . . . . . . . . . . . . . . . . . . . . . . 336
12.6.1 Left identity . . . . . . . . . . . . . . . . . . . . . . . 336
12.6.2 Right identity . . . . . . . . . . . . . . . . . . . . . . . 337
12.6.3 Associativity . . . . . . . . . . . . . . . . . . . . . . . 338
评论1
最新资源