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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
kanaya
July 28, 2025
Education
0
34
PLT-14 IO Monad
kanaya
July 28, 2025
Tweet
Share
More Decks by kanaya
See All by kanaya
PLT-A4 IO Monad
kanaya
0
28
SCA-07 Art and Entertainment
kanaya
0
92
PLT-A3 Maybe Monad
kanaya
0
40
PLT-A2 Closure
kanaya
0
47
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
1202
cbtlibrary
0
220
Introduction - Lecture 1 - Next Generation User Interfaces (4018166FNR)
signer
PRO
2
4.4k
1216
cbtlibrary
0
150
MySmartSTEAM 2526
cbtlibrary
0
200
2025 Toastmasters Path Reference
boyarsky
0
120
Surviving the surfaceless web
jonoalderson
0
710
Padlet opetuksessa
matleenalaakso
11
15k
Web 2.0 Patterns and Technologies - Lecture 8 - Web Technologies (1019888BNR)
signer
PRO
0
3.1k
国際卓越研究大学計画|Science Tokyo(東京科学大学)
sciencetokyo
PRO
0
48k
Web Search and SEO - Lecture 10 - Web Technologies (1019888BNR)
signer
PRO
2
3.1k
Data Representation - Lecture 3 - Information Visualisation (4019538FNR)
signer
PRO
1
2.8k
Write to Win: Crafting Winning Application Essays
em07adoz
0
120
Featured
See All Featured
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
460
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
92
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
400
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
Fireside Chat
paigeccino
41
3.8k
Everyday Curiosity
cassininazir
0
150
Designing Experiences People Love
moore
143
24k
A Tale of Four Properties
chriscoyier
162
24k
How GitHub (no longer) Works
holman
316
140k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.3k
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 ผղ