{"id":13631197,"url":"https://github.com/llh911001/mostly-adequate-guide-chinese","last_synced_at":"2026-02-22T19:38:02.359Z","repository":{"id":35064865,"uuid":"39205545","full_name":"llh911001/mostly-adequate-guide-chinese","owner":"llh911001","description":"函数式编程指南中文版","archived":false,"fork":false,"pushed_at":"2023-03-16T13:37:28.000Z","size":3934,"stargazers_count":2531,"open_issues_count":8,"forks_count":335,"subscribers_count":74,"default_branch":"master","last_synced_at":"2025-04-18T07:50:38.128Z","etag":null,"topics":["curry","functional-js","functional-programming","functor","monad"],"latest_commit_sha":null,"homepage":"https://llh911001.gitbook.io/mostly-adequate-guide-chinese","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/llh911001.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-07-16T15:36:05.000Z","updated_at":"2025-03-29T09:52:09.000Z","dependencies_parsed_at":"2022-07-12T10:01:44.949Z","dependency_job_id":"58955c69-fa76-446a-8674-4ffb90842d36","html_url":"https://github.com/llh911001/mostly-adequate-guide-chinese","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/llh911001/mostly-adequate-guide-chinese","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llh911001%2Fmostly-adequate-guide-chinese","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llh911001%2Fmostly-adequate-guide-chinese/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llh911001%2Fmostly-adequate-guide-chinese/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llh911001%2Fmostly-adequate-guide-chinese/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/llh911001","download_url":"https://codeload.github.com/llh911001/mostly-adequate-guide-chinese/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llh911001%2Fmostly-adequate-guide-chinese/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29724887,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T19:31:23.314Z","status":"ssl_error","status_checked_at":"2026-02-22T19:31:18.643Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["curry","functional-js","functional-programming","functor","monad"],"created_at":"2024-08-01T22:02:14.973Z","updated_at":"2026-02-22T19:38:02.325Z","avatar_url":"https://github.com/llh911001.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","JavaScript (485)"],"sub_categories":[],"readme":"\u003e This is the Simplified Chinese translation of *[mostly-adequate-guide](https://github.com/DrBoolean/mostly-adequate-guide)*, thank Professor [Franklin Risby](https://github.com/DrBoolean) for his great work!\n\n\n\u003c!-- \u003cimg src=\"images/cover.png\"/\u003e --\u003e\n\n# 关于本书\n\n这本书的主题是函数范式（functional paradigm），我们将使用 JavaScript 这门世界上最流行的函数式编程语言来讲述这一主题。有人可能会觉得选择 JavaScript 并不明智，因为当前的主流观点认为它是一门命令式（imperative）的语言，并不适合用来讲函数式。但我认为，这是学习函数式编程的最好方式，因为：\n\n * **你很有可能在日常工作中使用它**\n\n    这让你有机会在实际的编程过程中学以致用，而不是在空闲时间用一门深奥的函数式编程语言做一些玩具性质的项目。\n\n * **你不必从头学起就能开始编写程序**\n\n    在纯函数式编程语言中，你必须使用 monad 才能打印变量或者读取 DOM 节点。JavaScript 则简单得多，可以作弊走捷径，因为毕竟我们的目的是学写纯函数式代码。JavaScript 也更容易入门，因为它是一门混合范式的语言，你随时可以在感觉吃力的时候回退到原有的编程习惯上去。\n\n * **这门语言完全有能力书写高级的函数式代码**\n\n    只需借助一到两个微型类库，JavaScript 就能模拟 Scala 或 Haskell 这类语言的全部特性。虽然面向对象编程（Object-oriented programing）主导着业界，但很明显这种范式在 JavaScript 里非常笨拙，用起来就像在高速公路上露营或者穿着橡胶套鞋跳踢踏舞一样。我们不得不到处使用 `bind` 以免 `this` 不知不觉地变了，语言里没有类可以用（目前还没有），我们还发明了各种变通方法来应对忘记调用 `new` 关键字后的怪异行为，私有成员只能通过闭包（closure）才能实现，等等。对大多数人来说，函数式编程看起来更加自然。\n\n以上说明，强类型的函数式语言毫无疑问将会成为本书所示范式的最佳试验场。JavaScript 是我们学习这种范式的一种手段，将它应用于什么地方则完全取决于你自己。幸运的是，所有的接口都是数学的，因而也是普适的。最终你会发现你习惯了 swiftz、scalaz、haskell 和 purescript，以及其他各种数学偏向的语言。\n\n### Gitbook (更好的阅读体验)\n\n* [在线阅读](https://llh911001.gitbooks.io/mostly-adequate-guide-chinese/content/)\n* [下载EPUB](https://www.gitbook.com/download/epub/book/llh911001/mostly-adequate-guide-chinese)\n* [下载Mobi (Kindle)](https://www.gitbook.com/download/mobi/book/llh911001/mostly-adequate-guide-chinese)\n\n# 目录\n\n## 第 1 部分\n\n* [第 1 章: 我们在做什么？](ch1.md)\n  * [介绍](ch1.md#介绍)\n  * [一个简单例子](ch1.md#一个简单例子)\n* [第 2 章: 一等公民的函数](ch2.md)\n  * [快速概览](ch2.md#快速概览)\n  * [为何钟爱一等公民](ch2.md#为何钟爱一等公民)\n* [第 3 章: 纯函数的好处](ch3.md)\n  * [再次强调“纯”](ch3.md#再次强调“纯”)\n  * [副作用可能包括...](ch3.md#副作用可能包括)\n  * [八年级数学](ch3.md#八年级数学)\n  * [追求“纯”的理由](ch3.md#追求“纯”的理由)\n  * [总结](ch3.md#总结)\n* [第 4 章: 柯里化（curry）](ch4.md)\n  * [不可或缺的 curry](ch4.md#不可或缺的-curry)\n  * [不仅仅是双关语／咖喱](ch4.md#不仅仅是双关语咖喱)\n  * [总结](ch4.md#总结)\n* [第 5 章: 代码组合（compose）](ch5.md)\n  * [函数饲养](ch5.md#函数饲养)\n  * [pointfree](ch5.md#pointfree)\n  * [debug](ch5.md#debug)\n  * [范畴学](ch5.md#范畴学)\n  * [总结](ch5.md#总结)\n* [第 6章: 示例应用](ch6.md)\n  * [声明式代码](ch6.md#声明式代码)\n  * [一个函数式的 flickr](ch6.md#一个函数式的-flickr)\n  * [有原则的重构](ch6.md#有原则的重构)\n  * [总结](ch6.md#总结)\n\n## 第 2 部分\n\n* [第 7 章: Hindley-Milner 类型签名](ch7.md)\n  * [初识类型](ch7.md#初识类型)\n  * [神秘的传奇故事](ch7.md#神秘的传奇故事)\n  * [缩小可能性范围](ch7.md#缩小可能性范围)\n  * [自由定理](ch7.md#自由定理)\n  * [总结](ch7.md#总结)\n* [第 8 章: 特百惠](ch8.md)\n  * [强大的容器](ch8.md#强大的容器)\n  * [第一个 functor](ch8.md#第一个-functor)\n  * [薛定谔的 Maybe](ch8.md#薛定谔的-maybe)\n  * [“纯”错误处理](ch8.md#“纯”错误处理)\n  * [王老先生有作用...](ch8.md#王老先生有作用)\n  * [异步任务](ch8.md#异步任务)\n  * [一点理论](ch8.md#一点理论)\n  * [总结](ch8.md#总结)\n* [第 9 章: Monad](ch9.md)\n  * [pointed functor](ch9.md#pointed-functor)\n  * [混合比喻](ch9.md#混合比喻)\n  * [chain 函数](ch9.md#chain-函数)\n  * [理论](ch9.md#理论)\n  * [总结](ch9.md#总结)\n* [第 10 章: Applicative Functor](ch10.md)\n  * [应用 applicative functor](ch10.md#应用-applicative-functor)\n  * [瓶中之船](ch10.md#瓶中之船)\n  * [协调与激励](ch10.md#协调与激励)\n  * [lift](ch10.md#lift)\n  * [免费开瓶器](ch10.md#免费开瓶器)\n  * [定律](ch10.md#定律)\n  * [总结](ch10.md#总结)\n* [第 11 章: 再转换一次，就很自然](ch11.md)\n  * [令人生厌的嵌套](ch11.md#令人生厌的嵌套)\n  * [一场情景喜剧](ch11.md#一场情景喜剧)\n  * [全都很自然](ch11.md#全都很自然)\n  * [有原则的类型转换](ch11.md#有原则的类型转换)\n  * [方法狂](ch11.md#方法狂)\n  * [同构的 JavaScript](ch11.md#同构的-javascript)\n  * [更加宽泛的定义](ch11.md#更加宽泛的定义)\n  * [实现单层嵌套的方法](ch11.md#实现单层嵌套的方法)\n  * [总结](ch11.md#总结)\n* [第 12 章: 遍历](ch12.md)\n  * [类型与类型](ch12.md#类型与类型)\n  * [类型风水](ch12.md#类型风水)\n  * [作用组合](ch12.md#作用组合)\n  * [类型的华尔兹](ch12.md#类型的华尔兹)\n  * [定律](ch12.md#定律)\n  * [同一律](ch12.md#同一律-identity)\n  * [组合](ch12.md#组合-composition)\n  * [自然](ch12.md#自然-naturality)\n  * [总结](ch12.md#总结)\n* [第 13 章：集大成者的 Monoid](ch13.md)\n  * [狂野的 Combination](ch13.md#狂野的-combination)\n  * [将加法抽象化](ch13.md#将加法抽象化)\n  * [我喜爱的 functor 都是 semigroup](ch13.md#我喜爱的-functor-都是-semigroup)\n  * [空的 Monoid](ch13.md#空的-monoid)\n  * [把房子折叠起来](ch13.md#把房子折叠起来)\n  * [不太算 Monoid](ch13.md#不太算-monoid)\n  * [大一统理论](ch13.md#大一统理论)\n  * [群论还是范畴论](ch13.md#群论还是范畴论)\n  * [总结](ch13.md#总结)\n\n# 未来计划\n\n* 第 1 部分是基础知识。这是初版草稿，所以我会及时更正发现的的错误。欢迎提供帮助！\n* 第 2 部分讲述类型类（type class），比如 functor 和 monad，最后会讲到到 traversable。我希望能塞进来一些 monad transformer 相关的知识，再写一个纯函数的应用。\n* 第 3 部分将开始游走于编程实践与学院学究之间。我们将学习 comonad、f-algebra、free monad、yoneda 以及其他一些范畴学概念。\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllh911001%2Fmostly-adequate-guide-chinese","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fllh911001%2Fmostly-adequate-guide-chinese","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllh911001%2Fmostly-adequate-guide-chinese/lists"}