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-14 IO Monad
Search
kanaya
July 28, 2025
Education
0
29
PLT-14 IO Monad
kanaya
July 28, 2025
Tweet
Share
More Decks by kanaya
See All by kanaya
PLT-A4 IO Monad
kanaya
0
26
SCA-07 Art and Entertainment
kanaya
0
90
PLT-A3 Maybe Monad
kanaya
0
38
PLT-A2 Closure
kanaya
0
43
PLT-A1 Programming Principles
kanaya
0
30
PLT-X1 Division by Zero and Maybe
kanaya
1
71
IUM-03-Short Series of Functions
kanaya
0
140
PLT-02 How to Count Words
kanaya
0
99
IMU-00 Pi
kanaya
0
410
Other Decks in Education
See All in Education
✅ レポート採点基準 / How Your Reports Are Assessed
yasslab
PRO
0
280
1216
cbtlibrary
0
140
核軍備撤廃に向けた次の大きな一歩─核兵器を先には使わないと核保有国が約束すること
hide2kano
0
240
Activité_5_-_Les_indicateurs_du_climat_global.pdf
bernhardsvt
0
140
ロータリー国際大会について~国際大会に参加しよう~:古賀 真由美 会員(2720 Japan O.K. ロータリーEクラブ・(有)誠邦産業 取締役)
2720japanoke
1
770
20251119 如果是勇者欣美爾的話, 他會怎麼做? 東海資工
pichuang
0
170
SJRC 2526
cbtlibrary
0
200
学習指導要領と解説に基づく学習内容の構造化の試み / Course of study Commentary LOD JAET 2025
masao
0
120
TeXで変える教育現場
doratex
1
13k
KBS新事業創造体験2025_科目説明会
yasuchikawakayama
0
160
2025-12-11 nakanoshima.dev LT
takesection
0
110
【洋書和訳:さよならを待つふたりのために】第1章 出会いとメタファー
yaginumatti
0
240
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
730
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
Testing 201, or: Great Expectations
jmmastey
46
8k
The Limits of Empathy - UXLibs8
cassininazir
1
220
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
0
1.1k
Faster Mobile Websites
deanohume
310
31k
Un-Boring Meetings
codingconduct
0
200
Mind Mapping
helmedeiros
PRO
0
88
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
380
Darren the Foodie - Storyboard
khoart
PRO
2
2.4k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
69
Transcript
pineapple.cc ۚ୩Ұ࿕ʢ࡚େֶใσʔλՊֶ෦ʣ *0Ϟφυ ϓϩάϥϛϯάݴޠ
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
pineapple.cc
pineapple.cc
pineapple.cc
pineapple.cc
pineapple.cc
pineapple.cc
pineapple.cc x :: String x = “Hello, world!” main =
print x
pineapple.cc x :: IO String x = getLine main =
x >>= print
pineapple.cc x :: IO String x = getLine f ::
String -> String f x = if length x > 3 then “Too long.” else x main = (f x) >>= print
pineapple.cc x :: IO String x = getLine f ::
String -> IO String f x = if length x > 3 then return “Too long.” else return x main = (f x) >>= print
pineapple.cc x :: IO String x = getLine f ::
IO String -> IO String f x = x >>= (\x’ -> if length x’ > 3 then return “Too long.” else return x’) main = (f x) >>= print
pineapple.cc x :: IO String x = getLine f ::
String -> String f x = if length x > 3 then “Too long.” else x f’ :: IO String -> IO String f’ = liftM f main = (f' x) >>= print ผղ
pineapple.cc x :: IO String x = getLine f ::
String -> String f x = if length x > 3 then “Too long.” else x f’ :: IO String -> IO String f’ = liftM f main = (return x) >>= f’ >>= print ผղ
pineapple.cc x :: IO String x = getLine f ::
String -> String f x = if length x > 3 then “Too long.” else x main = x >>= (\x’ -> return (f x’)) >>= print ผղ