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
25
PLT-14 IO Monad
kanaya
July 28, 2025
Tweet
Share
More Decks by kanaya
See All by kanaya
PLT-A4 IO Monad
kanaya
0
22
SCA-07 Art and Entertainment
kanaya
0
86
PLT-A3 Maybe Monad
kanaya
0
34
PLT-A2 Closure
kanaya
0
34
PLT-A1 Programming Principles
kanaya
0
28
PLT-X1 Division by Zero and Maybe
kanaya
1
66
IUM-03-Short Series of Functions
kanaya
0
140
PLT-02 How to Count Words
kanaya
0
94
IMU-00 Pi
kanaya
0
410
Other Decks in Education
See All in Education
MySmartSTEAM 2526
cbtlibrary
0
170
国際卓越研究大学計画|Science Tokyo(東京科学大学)
sciencetokyo
PRO
0
41k
Software
irocho
0
650
子どものためのプログラミング道場『CoderDojo』〜法人提携例〜 / Partnership with CoderDojo Japan
coderdojojapan
PRO
4
17k
生成AIとの付き合い方 / Generative AI and us
kaityo256
PRO
11
6.7k
俺と地方勉強会 - KomeKaigi・地方勉強会への期待 -
pharaohkj
1
1.6k
卒論の書き方 / Happy Writing
kaityo256
PRO
51
27k
HyRead2526
cbtlibrary
0
170
焦りと不安を、技術力に変える方法 - 新卒iOSエンジニアの失敗談と成長のフレームワーク
hypebeans
1
620
Design Guidelines and Models - Lecture 5 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.2k
子どもが自立した学習者となるデジタルの活用について
naokikato
PRO
0
170
くまのココロンともぐらのロジ
frievea
0
130
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
698
190k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.3k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
97
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.2k
The browser strikes back
jonoalderson
0
230
Ethics towards AI in product and experience design
skipperchong
1
140
The #1 spot is gone: here's how to win anyway
tamaranovitovic
1
870
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
73
Bash Introduction
62gerente
615
210k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
48
Accessibility Awareness
sabderemane
0
24
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.8k
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 ผղ