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
PLT-A3 Maybe Monad
Search
kanaya
July 26, 2025
Education
0
36
PLT-A3 Maybe Monad
kanaya
July 26, 2025
Tweet
Share
More Decks by kanaya
See All by kanaya
PLT-A4 IO Monad
kanaya
0
22
PLT-14 IO Monad
kanaya
0
26
SCA-07 Art and Entertainment
kanaya
0
87
PLT-A2 Closure
kanaya
0
37
PLT-A1 Programming Principles
kanaya
0
28
PLT-X1 Division by Zero and Maybe
kanaya
1
68
IUM-03-Short Series of Functions
kanaya
0
140
PLT-02 How to Count Words
kanaya
0
96
IMU-00 Pi
kanaya
0
410
Other Decks in Education
See All in Education
1014
cbtlibrary
0
510
HCI and Interaction Design - Lecture 2 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.5k
Human Perception and Cognition - Lecture 4 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.3k
10分で学ぶ すてきなモナド
soukouki
1
130
IHLヘルスケアリーダーシップ研究会17期説明資料
ihlhealthcareleadership
0
430
Requirements Analysis and Prototyping - Lecture 3 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.4k
多様なメンター、多様な基準
yasulab
5
19k
✅ レポート採点基準 / How Your Reports Are Assessed
yasslab
PRO
0
270
RGBでも蛍光を!? / RayTracingCamp11
kugimasa
2
320
AWS re_Invent に全力で参加したくて筋トレを頑張っている話
amarelo_n24
1
110
外国籍エンジニアの挑戦・新卒半年後、気づきと成長の物語
hypebeans
0
700
Adobe Express
matleenalaakso
1
8.1k
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.3k
Navigating Team Friction
lara
191
16k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
160
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
110
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
330
Context Engineering - Making Every Token Count
addyosmani
9
590
The Art of Programming - Codeland 2020
erikaheidi
56
14k
The Limits of Empathy - UXLibs8
cassininazir
1
200
The #1 spot is gone: here's how to win anyway
tamaranovitovic
1
880
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
230
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
How to build a perfect <img>
jonoalderson
1
4.8k
Transcript
pineapple.cc ۚ୩Ұ࿕ʢ࡚େֶใσʔλՊֶ෦ʣ ʲิʳ.BZCFϞφυ ϓϩάϥϛϯάݴޠ
pineapple.cc Value Func Value’ x′  = fx
pineapple.cc Value Func Value’ Func3 Func2 Func1 • • x′
 = (h ∙ g ∙ f)x
pineapple.cc Value Func Value’ x′  = fx Float
pineapple.cc 1 0 = ?
None
pineapple.cc θϩআࢉͷରԠ w ϓϩάϥϜΛҟৗऴྃͤ͞Δʢྫ֎Λൃੜͤ͞Δʣ w ༗ཧશମɼ࣮શମΑΓʮ͍ʯू߹Λ͏ w *O fi OJUZͱ͍͏ʹ͢Δ
w /B/ /PUB/VNCFS ͱ͍͏ʹ͢Δ w ൚༻తͳΈΛ͏
pineapple.cc 1 0 = ?
pineapple.cc fx ≡ 1/x
pineapple.cc f :: Float -> Float f x = 1.0/x
pineapple.cc fx ≡ { 1/x if x ≠ 0 ∅
otherwise
pineapple.cc fx ≡ { ⟨1/x⟩ if x ≠ 0 ∅
otherwise
pineapple.cc f :: Float -> Float f x = 1/x
f :: Float -> Maybe Float f x = if x /= 0 then Just (1/x) else Nothing
pineapple.cc fx ≡ { ⟨1/x⟩ if x ≠ 0 ∅
otherwise
pineapple.cc fx ≡ { [1/x] if x ≠ 0 []
otherwise
pineapple.cc f :: Float -> Maybe Float f x =
if x /= 0 then Just (1/x) else Nothing f :: Float -> [Float] f x = if x /= 0 then [1/x] else []
pineapple.cc Value Func Value’ x′  = fx Maybe Float
Float
pineapple.cc Value Func’ Value’ x′  = f′  x
Maybe Float Maybe Float
pineapple.cc f′  x ≡ { ⟨1/x⟩ if x ≠
∅ and x ≠ 0 ∅ otherwise
pineapple.cc Value Func Value’ Func3 Func2 Func1 • • x′
 = (h ∙ g ∙ f)x
pineapple.cc Value Func’ Value’ Func3 Func2 Func1 • • x′
 = (h ∘ g ∘ f)x
pineapple.cc fx ≡ { ⟨1/x⟩ if x ≠ 0 ∅
otherwise
pineapple.cc fx ≡ { ⟨1/x⟩ if x ≠ 0 ∅
otherwise gx ≡ 2.0 × x
pineapple.cc fx ≡ { ⟨1/x⟩ if x ≠ 0 ∅
otherwise gx ≡ 2.0 × x g′  x ≡ ⟨gx⟩
pineapple.cc fx ≡ { ⟨1/x⟩ if x ≠ 0 ∅
otherwise gx ≡ 2.0 × x g′  x ≡ ⟨gx⟩ x′  ≡ (g′  ∘ f)x
pineapple.cc fx ≡ { ⟨1/x⟩ if x ≠ 0 ∅
otherwise gx ≡ 2.0 × x g′  x ≡ ⟨gx⟩ x′  ≡ ⟨x⟩ ↣ f ↣ g′ 
pineapple.cc f :: Float -> Maybe Float f x =
if x /= 0 then Just (1/x) else Nothing g :: Float -> Float g x = 2.0*x g’ :: Float -> Maybe Float g’ x = Just (g x) x’ = Just 2 >>= f >>= g’
pineapple.cc f :: Float -> Maybe Float f x =
if x /= 0 then Just (1/x) else Nothing g :: Float -> Float g x = 2.0*x x’ = (liftM g . f) x ผղ
pineapple.cc fx ≡ { ⟨1/x⟩ if x ≠ ∅ and
x ≠ 0 ∅ otherwise gx ≡ 2.0 × x x′  ≡ (g* ∙ f)x ผղ