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
Fun of Types
Search
Ryosuke TAKASHIMA
February 22, 2019
Programming
0
53
Fun of Types
Ryosuke TAKASHIMA
February 22, 2019
Tweet
Share
More Decks by Ryosuke TAKASHIMA
See All by Ryosuke TAKASHIMA
GCP native cloud migration
rst76
1
510
Cloud migration of the essential service
rst76
1
580
About purely functional language
rst76
0
130
performance-tuning-of-the-microservice.pdf
rst76
0
1.5k
red-black-tree.pdf
rst76
0
89
Understanding Subtype in 5 Minutes
rst76
0
170
Embedded Probabilistic Programming
rst76
0
350
Other Decks in Programming
See All in Programming
Flutter with Dart MCP: All You Need - 박제창 2025 I/O Extended Busan
itsmedreamwalker
0
150
ファインディ株式会社におけるMCP活用とサービス開発
starfish719
0
1.7k
「手軽で便利」に潜む罠。 Popover API を WCAG 2.2の視点で安全に使うには
taitotnk
0
860
Introducing ReActionView: A new ActionView-compatible ERB Engine @ Rails World 2025, Amsterdam
marcoroth
0
690
go test -json そして testing.T.Attr / Kyoto.go #63
utgwkk
3
310
私の後悔をAWS DMSで解決した話
hiramax
4
210
アルテニア コンサル/ITエンジニア向け 採用ピッチ資料
altenir
0
110
今から始めるClaude Code入門〜AIコーディングエージェントの歴史と導入〜
nokomoro3
0
190
基礎から学ぶ大画面対応(Learning Large-Screen Support from the Ground Up)
tomoya0x00
0
1.6k
アプリの "かわいい" を支えるアニメーションツールRiveについて
uetyo
0
270
モバイルアプリからWebへの横展開を加速した話_Claude_Code_実践術.pdf
kazuyasakamoto
0
330
AI Coding Agentのセキュリティリスク:PRの自己承認とメルカリの対策
s3h
0
230
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
113
20k
Building Applications with DynamoDB
mza
96
6.6k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
Into the Great Unknown - MozCon
thekraken
40
2k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.6k
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
Rails Girls Zürich Keynote
gr2m
95
14k
Designing Experiences People Love
moore
142
24k
Optimizing for Happiness
mojombo
379
70k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
139
34k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.4k
Transcript
ͨͷ͍͠ܕ ج൫(ɹߴౡ྄༞
ࣗݾհ w ߴౡ྄༞ʢ!STUʣ w ͖ͳͷɿখઆɺϚϯΨɺΞχϝʢ4'த৺ʣ ΧϥΦέɺຑɺόεέ w
༁ w ʰϫϯεɾΞϙϯɾΞϯɾΞϧΰ ϦζϜʱͱ͍͏ຊΛ༁͠·ͨ͠ ʢʣ IUUQTXXXBNB[PODPKQEQ w l*NQSBDUJDBM1ZUIPO1SPKFDUT 1MBZGVM1SPHSBNNJOH"DUJWJUJFT
UP.BLF:PV4NBSUFSz ͱ͍͏ຊΛ༁༧ఆ ϨϏϡΞืूதͰ͢ʂ
ܕ w ࠷ۙ੩తܕ͚͕ਓؾʁʢ5ZQF4DSJQUɺ(Pʣ w ܕͷ͋Δݴޠɾܕͷແ͍ݴޠ w ܕͨͷ͍͠ʂʂʂ
ܕͷ֊ʢ+BWBʣ Collection List Set ArrayList LinkedList HashSet TreeSet add(E e)
get(int index)
ܕͷ֊ʢ)BTLFMMʣ Functor Applicative Functor Monad [] Maybe IO r ->
fmap (<$>) (>>=) Ϧετ ೖग़ྗ ؔ ͍ΘΏΔ0QUJPOBM
'VODUPS GNBQ ͷྫ fmap (show . (* 3)) [1..4] --
3ഒͯ͠จࣈྻʹม => ["3", "6", "9", "12"] fmap fromEnum (Just 'F') -- ίʔυϙΠϯτΛऔಘ => Just 70 fmap fromEnum Nothing -- த͕ͳ͚ΕԿ͠ͳ͍ => Nothing
'VODUPS GNBQ ͷղऍ w 'VODUPSΛശͱଊ͑Δͱɺ GNBQശͷܗΛม͑ͣʹதΛม͑Δૢ࡞ fmap :: Functor f
=> (a -> b) -> f a -> f b fmap :: (a -> b) -> [a] -> [b] fmap :: (a -> b) -> Maybe a -> Maybe b
'VODUPSͱͯ͠ͷؔ w ؔSB'VODUPSʢSΛ͢ͱBΛฦͯ͘͠ΕΔശʁʣ ͰGNBQԿʁ fmap :: Functor f => (a
-> b) -> f a -> f b fmap :: (a -> b) -> (r -> a) -> (r -> b) fmap = (.) fmap (fmap show (* 3)) [1..4] w SBͱBCΛͭͳ͛Δؔ߹ʂ w ͔ͩΒ͜͏ॻ͚Δ
.POBEͱ w ҎԼͷͭͷίʔυՁ w Ұͭͷ݁Ռແࢹͯ͠ɺೋͭΛऔಘ print [1..4] >> print
"hoge" do print [1..4] print "hoge" (>>) :: Monad m => m a -> m b -> m b (>>) :: IO a -> IO b -> IO b
.POBEͱͯ͠ͷϦετ w ҎԼͲ͏ͳΔʁ w ͭ·ΓqBU.BQͷಛघܗͳͷͰʜ ͪͳΈʹҎԼͷΑ͏ʹॻ͚Δ (>>)
:: Monad m => m a -> m b -> m b (>>) :: [a] -> [b] -> [b] [1..4] >> "hoge" do [1..4] "hoge"
·ͱΊ w Ϧετೖग़ྗؔಉ͡ͷ w ܕͨͷ͍͠ʂʂ)BTLFMMͨͷ͍͠ʂʂ w ܕ͕ແ͍ੈքͷผͷػձʹ