惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
Y
Y Combinator Blog
Recorded Future
Recorded Future
博客园 - Franky
I
InfoQ
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
T
Tailwind CSS Blog
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
Cloudbric
Cloudbric
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Check Point Blog
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
T
Threat Research - Cisco Blogs
U
Unit 42
N
Netflix TechBlog - Medium
The Cloudflare Blog
Spread Privacy
Spread Privacy
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队
T
Troy Hunt's Blog
Engineering at Meta
Engineering at Meta
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
B
Blog
S
Securelist
H
Hacker News: Front Page
Google Online Security Blog
Google Online Security Blog
G
Google Developers Blog

Haskell

哪个函数返回参数本身? - V2EX GHC 9.2 发布了 - V2EX 那本书可以称为编程界的《葵花宝典》? - V2EX 国内有什么好的 Haskell 社群( qq/wechat/论坛)吗? - V2EX 如何修复错误“Variable not in scope: md5 :: C8.ByteString -> a0”? - V2EX Haskell 这门语言怎么样? - V2EX 写了篇 Applicative 的小总结~ - V2EX 有没有小伙伴一起来团购 Haskell Programming 这本书 - V2EX 为什么学了 Haskell,果然印证了 V2EX 上的 智者(忘记网名)的断论,“学了 Haskell,回不去了“, 回不去了耶。 - V2EX 贴 Haskell 代码,解一道小题。给任意字符串,找出长度最长的数字串。请随意扔砖头。 http://www.v2ex.com/t/259360#reply18 - V2EX 一个很酷的 Hakyll 静态博客例子 - V2EX 发现一本好书《Haskell Data Analysis Cookbook》 - V2EX How to Write a Spelling Corrector - Haskell - V2EX Haskell 入门学习资料整理 - V2EX Haskell for Mac - V2EX Yesod - Haskell 的 Web 开发框架 - V2EX Haskell 怎么在只有一个元素的列表上定义函数 - V2EX 一段 Haskell 代码求助! - V2EX Haskell 很适合做编译器前端 - V2EX Introduction to Haskell - V2EX 在 Github 上弄了一个 blog, 写写 Haskell - V2EX 关于一些名词翻译的确定 - V2EX 有没有人有兴趣补完 《趣学指南》 的汉语翻译? - V2EX 贺 haskell 开区,这是交流处。 - V2EX
学习 Haskell 过程中,写了一篇对 Functor 的总结 - V2EX
scarlex · 2016-02-11 · via Haskell
bramblex

5

bramblex      2016 年 3 月 1 日   ❤️ 1

functor 是函子

fmap 实际上就是一个 类型 T(a) -> T(b) 的一个映射。

======================

为什么 fmap id = id ?首先 id 的类型是 a -> a ,你给 fmap 了以后, fmap id 是不是变成了 T(a) -> T(a) 了?现在令 T(a) 为 a ,是不是 fmap id 又变回 a -> a 了?

为什么 fmap (f . g) = fmap f . fmap g 呢?
假设 f : a -> b, g: b -> c ,那么 f . g : a -> c
f . g : a -> c
famp (f . g) : T(a) -> T(c)

fmap f : T(a) -> T(b)
fmap g : T(b) -> T(c)
fmap f . fmap g : T(a) -> T(c)

所以 fmap (f .g) = fmap f . fmap g