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
プロパティベーステストによるUIテスト: LLMによるプロパティ定義生成でエッジケースを捉える
tetta_pdnt
0
3.3k
CJK and Unicode From a PHP Committer
youkidearitai
PRO
0
110
Design Foundational Data Engineering Observability
sucitw
3
200
ぬるぬる動かせ! Riveでアニメーション実装🐾
kno3a87
1
230
複雑なドメインに挑む.pdf
yukisakai1225
5
1.2k
rage against annotate_predecessor
junk0612
0
170
Processing Gem ベースの、2D レトロゲームエンジンの開発
tokujiros
2
130
楽して成果を出すためのセルフリソース管理
clipnote
0
180
AIと私たちの学習の変化を考える - Claude Codeの学習モードを例に
azukiazusa1
10
4.3k
Swift Updates - Learn Languages 2025
koher
2
490
「待たせ上手」なスケルトンスクリーン、 そのUXの裏側
teamlab
PRO
0
550
Android端末で実現するオンデバイスLLM 2025
masayukisuda
1
160
Featured
See All Featured
Site-Speed That Sticks
csswizardry
10
820
Agile that works and the tools we love
rasmusluckow
330
21k
Navigating Team Friction
lara
189
15k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.2k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
188
55k
Six Lessons from altMBA
skipperchong
28
4k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
580
Bash Introduction
62gerente
615
210k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.6k
Documentation Writing (for coders)
carmenintech
74
5k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
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
-> -> ->