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
25
PLT-A3 Maybe Monad
kanaya
July 26, 2025
Tweet
Share
More Decks by kanaya
See All by kanaya
PLT-A4 IO Monad
kanaya
0
12
PLT-14 IO Monad
kanaya
0
20
SCA-07 Art and Entertainment
kanaya
0
79
PLT-A2 Closure
kanaya
0
24
PLT-A1 Programming Principles
kanaya
0
23
PLT-X1 Division by Zero and Maybe
kanaya
1
42
IUM-03-Short Series of Functions
kanaya
0
120
PLT-02 How to Count Words
kanaya
0
75
IMU-00 Pi
kanaya
0
390
Other Decks in Education
See All in Education
生成AI
takenawa
0
12k
社外コミュニティと「学び」を考える
alchemy1115
2
170
仮説の取扱説明書/User_Guide_to_a_Hypothesis
florets1
4
340
ARアプリを活用した防災まち歩きデータ作成ハンズオン
nro2daisuke
0
140
データ分析
takenawa
0
12k
登壇未経験者のための登壇戦略~LTは設計が9割!!!~
masakiokuda
3
620
AI for Learning
fonylew
0
180
情報科学類で学べる専門科目38選
momeemt
0
550
新卒研修に仕掛ける 学びのサイクル / Implementing Learning Cycles in New Graduate Training
takashi_toyosaki
1
200
質のよいアウトプットをできるようになるために~「読む・聞く、まとめる、言葉にする」を読んで~
amarelo_n24
0
180
Human-AI Interaction - Lecture 11 - Next Generation User Interfaces (4018166FNR)
signer
PRO
0
490
Padlet opetuksessa
matleenalaakso
4
14k
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Raft: Consensus for Rubyists
vanstee
140
7.1k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3k
RailsConf 2023
tenderlove
30
1.2k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
21k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Statistics for Hackers
jakevdp
799
220k
GraphQLとの向き合い方2022年版
quramy
49
14k
Six Lessons from altMBA
skipperchong
28
3.9k
The Language of Interfaces
destraynor
158
25k
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 ผղ