V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
netcan
V2EX  ›  程序员

详解函数式编程之 Monad

  •  
  •   netcan ·
    netcan · 2020-10-02 11:37:39 +08:00 · 2609 次点击
    这是一个创建于 1273 天前的主题,其中的信息可能已经有所发展或是发生改变。

    最近终于搞清楚了 Monad 的本质,趁热记录下来,相信大家或多或少在编程语言中见过并用过,只不过不知道那是 Monad 罢了,也为了方便大家理解 Monad,后面我会用各种主流语言中具有代表性的 Monad 作为例子,如果对理论不感兴趣可以直接跳到后面,寻找你熟悉语言的例子进行理解后,再回头看看理论。感兴趣的可以看看我写的文章: https://zhuanlan.zhihu.com/p/260966706

    8 条回复    2024-01-15 10:15:52 +08:00
    aijam
        1
    aijam  
       2020-10-02 13:02:56 +08:00   ❤️ 4
    Every Haskell programmer will write a blog about Monad at some point
    leavebody
        2
    leavebody  
       2020-10-02 14:00:37 +08:00
    @aijam 哈哈哈哈哈
    thedrwu
        3
    thedrwu  
       2020-10-02 17:45:03 +08:00 via Android
    然后你会发现因为 monad transformer 运行效率特别低,最终舍弃这些抽象只拿来做 IO 。
    netcan
        4
    netcan  
    OP
       2020-10-03 00:54:49 +08:00
    @thedrwu 做异步抽象啊,比如 js 的 promise,c++也可以借鉴思想。
    netcan
        5
    netcan  
    OP
       2020-10-03 01:16:23 +08:00 via Android
    @aijam I'm a c++ progammer, not haskell
    Balthild
        6
    Balthild  
       2020-10-10 16:17:42 +08:00
    讲个玩笑:

    Monad 是这样一种奇怪的东西:每个人都能理解它,但每个人对它的表述都是错的。
    netcan
        7
    netcan  
    OP
       2020-10-24 16:40:43 +08:00
    @Balthild 看你怎么理解表述了
    GuangXiN
        8
    GuangXiN  
       73 天前
    @Balthild #6 听起来像在说上帝
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1043 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 22:24 · PVG 06:24 · LAX 15:24 · JFK 18:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.