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
20
PLT-14 IO Monad
kanaya
July 28, 2025
Tweet
Share
More Decks by kanaya
See All by kanaya
PLT-A4 IO Monad
kanaya
0
12
SCA-07 Art and Entertainment
kanaya
0
80
PLT-A3 Maybe Monad
kanaya
0
25
PLT-A2 Closure
kanaya
0
24
PLT-A1 Programming Principles
kanaya
0
23
PLT-X1 Division by Zero and Maybe
kanaya
1
46
IUM-03-Short Series of Functions
kanaya
0
120
PLT-02 How to Count Words
kanaya
0
77
IMU-00 Pi
kanaya
0
390
Other Decks in Education
See All in Education
2025年度春学期 統計学 第15回 分布についての仮説を検証する ー 仮説検定(2) (2025. 7. 17)
akiraasano
PRO
0
100
みんなのコードD&I推進レポート2025 テクノロジー分野のジェンダーギャップとその取り組みについて
codeforeveryone
0
210
(2025) L'origami, mieux que la règle et le compas
mansuy
0
130
生態系ウォーズ - ルールブック
yui_itoshima
1
250
フィードバックの伝え方、受け身のココロ / The Way of Feedback: Words and the Receiving Heart
spring_aki
1
140
【Discordアカウント作成ガイド】
ainischool
0
110
Open Source Summit Japan 2025のボランティアをしませんか
kujiraitakahiro
0
840
技術勉強会 〜 OAuth & OIDC 入門編 / 20250528 OAuth and OIDC
oidfj
5
1.8k
OpenSourceSummitJapanを運営してみた話
kujiraitakahiro
0
790
情報科学類で学べる専門科目38選
momeemt
0
590
DIP_1_Introduction
hachama
0
120
CHARMS-HP-Banner
weltraumreisende
0
770
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
70
11k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Facilitating Awesome Meetings
lara
55
6.5k
Music & Morning Musume
bryan
46
6.8k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
Documentation Writing (for coders)
carmenintech
74
5k
Making the Leap to Tech Lead
cromwellryan
135
9.5k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.1k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
188
55k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3k
Designing Experiences People Love
moore
142
24k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
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 ผղ