freeCodeCamp/guide/chinese/haskell/monad/index.md

25 lines
367 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: Monad
localeTitle: 单子
---
# Monad Laws
数据类型必须满足3个法则才能被视为monad
# 也许莫纳德
```haskell
justHead :: Maybe Char
justHead = do
(x:xs) <- Just ""
return x
```
# 列出Monad
回归与纯粹的应用相同
实例Monad \[\]在哪里
return x = \[x\]
xs >> = f = concatmap f xs
失败\_ = \[\]