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
理論と実務のギャップを超える
eycjur
0
140
AI Agent 時代的開發者生存指南
eddie
3
1.9k
(Extension DC 2025) Actor境界を越える技術
teamhimeh
1
260
登壇は dynamic! な営みである / speech is dynamic
da1chi
0
350
株式会社 Sun terras カンパニーデック
sunterras
0
360
XP, Testing and ninja testing ZOZ5
m_seki
3
730
スマホから Youtube Shortsを見られないようにする
lemolatoon
27
33k
SwiftDataを使って10万件のデータを読み書きする
akidon0000
0
170
CSC305 Lecture 04
javiergs
PRO
0
270
Web フロントエンドエンジニアに開かれる AI Agent プロダクト開発 - Vercel AI SDK を観察して AI Agent と仲良くなろう! #FEC余熱NIGHT
izumin5210
3
560
Pull-Requestの内容を1クリックで動作確認可能にするワークフロー
natmark
2
520
他言語経験者が Golangci-lint を最初のコーディングメンターにした話 / How Golangci-lint Became My First Coding Mentor: A Story from a Polyglot Programmer
uma31
0
240
Featured
See All Featured
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
190
55k
Why You Should Never Use an ORM
jnunemaker
PRO
59
9.6k
Building a Modern Day E-commerce SEO Strategy
aleyda
44
7.8k
Designing for Performance
lara
610
69k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Designing Experiences People Love
moore
142
24k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.2k
Automating Front-end Workflow
addyosmani
1371
200k
The Power of CSS Pseudo Elements
geoffreycrofte
79
6k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
Build your cross-platform service in a week with App Engine
jlugia
232
18k
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
-> -> ->