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
40
PLT-A3 Maybe Monad
kanaya
July 26, 2025
Tweet
Share
More Decks by kanaya
See All by kanaya
PLT-A4 IO Monad
kanaya
0
28
PLT-14 IO Monad
kanaya
0
34
SCA-07 Art and Entertainment
kanaya
0
92
PLT-A2 Closure
kanaya
0
46
PLT-A1 Programming Principles
kanaya
0
32
PLT-X1 Division by Zero and Maybe
kanaya
1
73
IUM-03-Short Series of Functions
kanaya
0
150
PLT-02 How to Count Words
kanaya
0
100
IMU-00 Pi
kanaya
0
410
Other Decks in Education
See All in Education
Web Search and SEO - Lecture 10 - Web Technologies (1019888BNR)
signer
PRO
2
3.1k
国際卓越研究大学計画|Science Tokyo(東京科学大学)
sciencetokyo
PRO
0
48k
Gluon Recruit Deck
gluon
0
110
【洋書和訳:さよならを待つふたりのために】第1章 出会いとメタファー
yaginumatti
0
260
Measuring your measuring
jonoalderson
2
710
Flinga
matleenalaakso
4
15k
おひとり様Organizations管理者もルートアクセス管理を有効にしよう!
amarelo_n24
2
120
1111
cbtlibrary
0
280
1125
cbtlibrary
0
190
Multimodal Interaction - Lecture 3 - Next Generation User Interfaces (4018166FNR)
signer
PRO
0
2k
Tips for the Presentation - Lecture 2 - Advanced Topics in Big Data (4023256FNR)
signer
PRO
0
480
0203
cbtlibrary
0
130
Featured
See All Featured
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
160
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Raft: Consensus for Rubyists
vanstee
141
7.3k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
67
37k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.2k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
970
Darren the Foodie - Storyboard
khoart
PRO
3
2.7k
Six Lessons from altMBA
skipperchong
29
4.2k
Why Our Code Smells
bkeepers
PRO
340
58k
Speed Design
sergeychernyshev
33
1.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 ผղ