Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Functors
Search
Sebastian Bruckner
June 21, 2017
Programming
0
26
Functors
Sebastian Bruckner
June 21, 2017
Tweet
Share
Other Decks in Programming
See All in Programming
Java 22 Overview
kishida
1
180
Folding Cheat Sheet #3
philipschwarz
PRO
0
120
Git Lint
bkuhlmann
4
750
PHPの次期バージョンはこの時期どうなっているのか - Internalsの開発体制について - PHPカンファレンス小田原
youkidearitai
PRO
1
190
Designing for tomorrow's programming workflows
honnibal
PRO
2
120
try!Swift Tokyo 2024 参加報告 LT
akidon0000
1
210
AWS Application Composerで始める、 サーバーレスなデータ基盤構築 / 20240406-jawsug-hokuriku-shinkansen
kasacchiful
1
260
FigmaとPHPで作る1ミリたりとも表示崩れしない最強の帳票印刷ソリューション
ttskch
43
18k
Goのmultiple errorsについて (2024年4月版)
syumai
1
310
サイコロで理解する統計的仮説検定の考え方
tatamiya
4
850
#phpcon_odawara オープン・クローズドなテストフィクスチャを求めて / open closed test fixtures
77web
3
220
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
110
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
124
32k
Music & Morning Musume
bryan
41
5.6k
The Cost Of JavaScript in 2023
addyosmani
15
3.8k
Build The Right Thing And Hit Your Dates
maggiecrowley
23
2k
The Brand Is Dead. Long Live the Brand.
mthomps
48
28k
Debugging Ruby Performance
tmm1
70
11k
The Pragmatic Product Professional
lauravandoore
24
5.8k
From Idea to $5000 a Month in 5 Months
shpigford
377
45k
How to Ace a Technical Interview
jacobian
272
22k
In The Pink: A Labor of Love
frogandcode
138
21k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
119
39k
The Illustrated Children's Guide to Kubernetes
chrisshort
30
46k
Transcript
Functors
Monoids
trait Monoid[A] { def empty: A def combine(one: A, another:
A): A }
Addition: empty: 0 combine: a + b Multiplication: empty: 1
combine: a * b List: empty: Nil combine: a ++ b
associativity: (x |+| y) |+| z = x |+| (y
|+| z) left identity: Monoid[A].empty |+| x = x right identity: x |+| Monoid[A].empty = x
Functors
// Option Some(2).map(_ * 3) === Some(6) None.map(_ * 3)
=== None
// List List(1, 2).map(_ * 3) === List(3, 6)
❓
Functors
trait Functor[F[_]] { def map[A, B](fa: F[A])(f: A => B):
F[B] }
identity: (x map identity) === x composition: (x map (v
=> g(f(v))) === (x map f map g)
Functors
-> -> ->