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
Lightning - Monads you already use (without kno...
Search
Tejas Dinkar
July 19, 2014
Technology
1
380
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
120
Progressive Web Apps In Clojure(Script)
gja
4
2.4k
Monads you've already put in production (without knowing it)
gja
1
1.1k
Native Extensions Served 3 Ways
gja
0
350
Other Decks in Technology
See All in Technology
Tensix Core アーキテクチャ解説
tenstorrent_japan
0
360
AI技術トレンド勉強会 #1MCPの基礎と実務での応用
nisei_k
1
190
Workflows から Agents へ ~ 生成 AI アプリの成長過程とアプローチ~
belongadmin
3
150
Long journey of Continuous Delivery at Mercari
hisaharu
1
210
Amplifyとゼロからはじめた AIコーディング 成果と展望
mkdev10
1
220
「規約、知識、オペレーション」から考える中規模以上の開発組織のCursorルールの 考え方・育て方 / Cursor Rules for Coding Styles, Domain Knowledges and Operations
yuitosato
6
1.6k
Devin(Deep) Wiki/Searchの活用で変わる開発の世界観/devin-wiki-search-impact
tomoki10
0
310
工具人的一生: 開發很多 AI 工具讓我 慵懶過一生
line_developers_tw
PRO
0
140
CIでのgolangci-lintの実行を約90%削減した話
kazukihayase
0
240
エンジニア採用から始まる技術広報と組織づくり/202506lt
nishiuma
8
1.7k
キャディでのApache Iceberg, Trino採用事例 -Apache Iceberg and Trino Usecase in CADDi--
caddi_eng
0
110
RubyOnRailsOnDevin+α / DevinMeetupJapan#2
ginkouno
0
370
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
430
65k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
6
690
Producing Creativity
orderedlist
PRO
346
40k
Fireside Chat
paigeccino
37
3.5k
Raft: Consensus for Rubyists
vanstee
139
7k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
650
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
Code Review Best Practice
trishagee
68
18k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
137
34k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Build The Right Thing And Hit Your Dates
maggiecrowley
36
2.7k
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