-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
面向 JavaScript 开发人员的 Monads #8102
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
![](https://cdn-images-1.medium.com/max/5760/1*gA2dHvfpZEylFTBuiLiKxw.jpeg) | ||
|
||
Like every other programmer, I wanted to know, what **Monads** are. But every time you search for Monads on the internet, you get flooded with category theory papers. And other resources don’t seem to make much sense either. | ||
和其他程序员一样,我也想知道 **Monads** 是什么。但是每次在网上搜索 Monads,都只会找到大量的 Monads 理论范畴文章,而其它资源似乎也没有参考意义。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
和其他程序员一样,我也想知道 **Monads** 是什么。但是每次在网上搜索 Monads,都只会找到大量的 Monads 理论范畴文章,而其它资源似乎也没有参考意义。 | |
和别的程序员一样,我也很想知道 **Monads** 到底是什么。但每当我在网上搜索 Monads 的时候,都只会找到大量的 Monads 理论范畴文章,而其它的资源似乎也并没有什么参考意义。 |
|
||
To learn what Monads are, I did it the hard way. I started learning Haskell. Only to realize, after few months, that people make too much of a fuss of Monads. If you’re a JavaScript developer, you’re most definitely using them daily. You’re just not aware of it. | ||
为了学会什么是 Monads,我花费了大量时间精力。我开始学习 Haskell,几个月后才发现,人们对 Monads 太小题大做了。如果你是一名 JavaScript 开发人员,那么你肯定每天都在使用它们,你只是没有意识到而已。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为了学会什么是 Monads,我花费了大量时间精力。我开始学习 Haskell,几个月后才发现,人们对 Monads 太小题大做了。如果你是一名 JavaScript 开发人员,那么你肯定每天都在使用它们,你只是没有意识到而已。 | |
为了搞清楚什么是 Monads,我花费了大量的时间精力。我开始去学习 Haskell,但在学了几个月后,我才突然意识到,大家都在 Monads 上面太小题大做了。如果你是一名 JavaScript 开发人员,那么你肯定每天都在使用它,只是你并没有意识到而已。 |
|
||
--- | ||
|
||
We won’t be getting into much detail about the category theory or Haskell, but there’s one thing you need to know. When you search for Monads on the internet, you cannot miss this definition: | ||
本文不会讲太多关于 Monads 理论范畴或 Haskell 的细节,但有一件事需要知道。当你在互联网上搜索 Monads 时,你不能错过这个定义: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
本文不会讲太多关于 Monads 理论范畴或 Haskell 的细节,但有一件事需要知道。当你在互联网上搜索 Monads 时,你不能错过这个定义: | |
本文并不会提及太多有关 Monads 的理论范畴或在 Haskell 中的细节,但有一件事我们始终需要知道 —— 当我们在互联网上搜索 Monads 时,我们不能错过这个定义: |
|
||
## JavaScript Promises Are Similar To Monads | ||
## Promises 类似 Monads |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Promises 类似 Monads | |
## JavaScript 中的 Promises 类似于 Monads |
@PassionPenguin 感谢校对 @lsvih 完成 1 次校对 |
校对认领 |
@zaviertang 欢迎校对 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
译者翻译的很好,逻辑清晰,检查了格式也没有任何问题。校对完成 @lsvih
|
||
--- | ||
|
||
We won’t be getting into much detail about the category theory or Haskell, but there’s one thing you need to know. When you search for Monads on the internet, you cannot miss this definition: | ||
本文并不会提及太多有关 Monads 的理论范畴或在 Haskell 中的细节,但有一件事我们始终需要知道 —— 当我们在互联网上搜索 Monads 时,我们不能错过这个定义: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
本文并不会提及太多有关 Monads 的理论范畴或在 Haskell 中的细节,但有一件事我们始终需要知道 —— 当我们在互联网上搜索 Monads 时,我们不能错过这个定义: | |
本文并不会提及太多有关 Monads 的理论范畴或 Haskell 的细节,但有一件事我们始终需要知道 —— 当我们在互联网上搜索 Monads 时,不能错过这个定义: |
|
||
```js | ||
// divideByTwo :: (a -> m b) | ||
const divideByTwo = val => Promise.resolve(val / 2); | ||
``` | ||
|
||
☝️ This is our `(a -> m b)`. | ||
☝️ 这是我们的 `(a -> m b)`。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☝️ 这是我们的 `(a -> m b)`。 | |
☝️ 这就是我们的 `(a -> m b)`。 |
@lsvih 完成 2 次校对 |
@zenblo 已经 merge 啦~ 快快麻溜发布到掘金然后给我发下链接,方便及时添加积分哟。 掘金翻译计划有自己的知乎专栏,你也可以投稿哈,推荐使用一个好用的插件。 |
收到 |
@lsvih 译文翻译完成,resolve #8058