Skip to content

Instantly share code, notes, and snippets.

@jude90
Last active August 29, 2015 14:01
Show Gist options
  • Save jude90/14baa3a3dbdcebc1ce6b to your computer and use it in GitHub Desktop.
Save jude90/14baa3a3dbdcebc1ce6b to your computer and use it in GitHub Desktop.
monad for js 摘抄

原文 那么monad 到底是什么呢? 它是一种设计模式。只要你有一堆函数,当它们接受一个参数而返回另一个值,就可以用以下两个函数把那些函数组合在一起。

  • bind 函数将其他函数变换成 输入参数与返回值 类型相同的类型, 使它们可以组合起来。
  • unit 函数将一个值包装成组合函数可以接受的模式
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment