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
30
PLT-A3 Maybe Monad
kanaya
July 26, 2025
Tweet
Share
More Decks by kanaya
See All by kanaya
PLT-A4 IO Monad
kanaya
0
13
PLT-14 IO Monad
kanaya
0
21
SCA-07 Art and Entertainment
kanaya
0
83
PLT-A2 Closure
kanaya
0
30
PLT-A1 Programming Principles
kanaya
0
25
PLT-X1 Division by Zero and Maybe
kanaya
1
56
IUM-03-Short Series of Functions
kanaya
0
130
PLT-02 How to Count Words
kanaya
0
86
IMU-00 Pi
kanaya
0
400
Other Decks in Education
See All in Education
あなたの言葉に力を与える、演繹的なアプローチ
logica0419
1
230
子どものためのプログラミング道場『CoderDojo』〜法人提携例〜 / Partnership with CoderDojo Japan
coderdojojapan
4
17k
Présentation_2nde_2025.pdf
bernhardsvt
0
340
H5P-työkalut
matleenalaakso
4
41k
Library Prefects 2025-2026
cbtlibrary
0
130
XML and Related Technologies - Lecture 7 - Web Technologies (1019888BNR)
signer
PRO
0
3.1k
Design Guidelines and Models - Lecture 5 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.2k
Master of Applied Science & Engineering: Computer Science & Master of Science in Applied Informatics: Artificial Intelligence and Data Science
signer
PRO
0
850
3Dプリンタでロボット作るよ#5_ロボット向け3Dプリンタ材料
shiba_8ro
0
120
Introduction - Lecture 1 - Web Technologies (1019888BNR)
signer
PRO
0
5.7k
IKIGAI World Fes:program
tsutsumi
2
2.6k
Node-REDで広がるプログラミング教育の可能性
ueponx
0
190
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
31
2.7k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
11
940
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.7k
A better future with KSS
kneath
239
18k
Balancing Empowerment & Direction
lara
5
760
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Git: the NoSQL Database
bkeepers
PRO
432
66k
A designer walks into a library…
pauljervisheath
210
24k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
2.9k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
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 ผղ