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
HCI Research Methods - Lecture 7 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.3k
渡辺研Slackの使い方 / Slack Local Rule
kaityo256
PRO
10
11k
Microsoft Office 365
matleenalaakso
0
2.1k
いわゆる「ふつう」のキャリアを歩んだ人の割合(若者向け)
hysmrk
0
310
NUTMEG紹介スライド
mugiiicha
0
910
Chapitre_2_-_Partie_3.pdf
bernhardsvt
0
150
0121
cbtlibrary
0
120
IHLヘルスケアリーダーシップ研究会17期説明資料
ihlhealthcareleadership
0
890
AWS re_Invent に全力で参加したくて筋トレを頑張っている話
amarelo_n24
2
120
Web 2.0 Patterns and Technologies - Lecture 8 - Web Technologies (1019888BNR)
signer
PRO
0
3k
コマンドラインを見直そう(1995年からタイムリープ)
sapi_kawahara
0
660
Measuring your measuring
jonoalderson
1
360
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
54
8k
WENDY [Excerpt]
tessaabrams
9
36k
From π to Pie charts
rasagy
0
120
エンジニアに許された特別な時間の終わり
watany
106
230k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
3.9k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
730
Amusing Abliteration
ianozsvald
0
100
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
940
KATA
mclloyd
PRO
34
15k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
55
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
110
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
62
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 ผղ