Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Lightning - Monads you already use (without kno...
Search
Tejas Dinkar
July 19, 2014
Technology
1
410
Lightning - Monads you already use (without knowing it)
The lightning talk version of this talk.
Tejas Dinkar
July 19, 2014
Tweet
Share
More Decks by Tejas Dinkar
See All by Tejas Dinkar
Quick Wins for Page Speed
gja
0
140
Progressive Web Apps In Clojure(Script)
gja
4
2.4k
Monads you've already put in production (without knowing it)
gja
1
1.2k
Native Extensions Served 3 Ways
gja
0
360
Other Decks in Technology
See All in Technology
学習データって増やせばいいんですか?
ftakahashi
1
240
AWS Trainium3 をちょっと身近に感じたい
bigmuramura
1
130
新 Security HubがついにGA!仕組みや料金を深堀り #AWSreInvent #regrowth / AWS Security Hub Advanced GA
masahirokawahara
1
1.4k
RAG/Agent開発のアップデートまとめ
taka0709
0
140
pmconf2025 - データを活用し「価値」へ繋げる
glorypulse
0
700
pmconf2025 - 他社事例を"自社仕様化"する技術_iRAFT法
daichi_yamashita
0
790
多様なデジタルアイデンティティを攻撃からどうやって守るのか / 20251212
ayokura
0
280
世界最速級 memcached 互換サーバー作った
yasukata
0
330
日本Rubyの会の構造と実行とあと何か / hokurikurk01
takahashim
4
940
手動から自動へ、そしてその先へ
moritamasami
0
280
AIと二人三脚で育てた、個人開発アプリグロース術
zozotech
PRO
0
690
5分で知るMicrosoft Ignite
taiponrock
PRO
0
220
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
How to Ace a Technical Interview
jacobian
280
24k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Agile that works and the tools we love
rasmusluckow
331
21k
Docker and Python
trallard
47
3.7k
Being A Developer After 40
akosma
91
590k
Scaling GitHub
holman
464
140k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.6k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Making the Leap to Tech Lead
cromwellryan
135
9.7k
Testing 201, or: Great Expectations
jmmastey
46
7.8k
Transcript
Monads you’ve already put in prod Tejas Dinkar Nilenso Software
about.me • Hi, I’m Tejas • Nilenso: Partner • twitter:
tdinkar • github: gja
If you think you understand Monads, you don't understand Monads.
This talk is inaccurate and will make a mathematician cry
Monads • Programmable Semicolons • Used to hide plumbing away
from you • Monads are just monoids in the category of endofunctors
None
Values Value
Monads Value Box
Monads • Monads define two functions • return takes a
value and puts it in a box • bind takes a box & function, and returns a box with f(value)
Some math (√4) + 5
Some math (√4) + 5 3 or 7!
Value 4
Monad [4]
return def m_return(x) [x] end # m_r(4) => [4]
Square Root fn def sqrt(x) s = Math.sqrt(x) [s, -s]
end # sqrt(4) => [2, -2]
Bind Function x = m_return(4) y = ?????(x) { |p|
sqrt(p) } # I want [-2, 2]
Bind Function x = m_return(4) y = x.flat_map {|p| sqrt(p)
} # y => [2, -2]
Increment Fn def inc_5(x) [x + 5] end # inc_5(1)
=> [6]
Putting it together m_return(4). flat_map {|p| sqrt(p)}. flat_map {|p| inc_5(p)}
# => [3, 7]
You have invented the List Monad, used to model non-determinism
Congrats