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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Ryosuke TAKASHIMA
February 22, 2019
Programming
0
56
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
530
Cloud migration of the essential service
rst76
1
600
About purely functional language
rst76
0
140
performance-tuning-of-the-microservice.pdf
rst76
0
1.6k
red-black-tree.pdf
rst76
0
91
Understanding Subtype in 5 Minutes
rst76
0
180
Embedded Probabilistic Programming
rst76
0
370
Other Decks in Programming
See All in Programming
今から始めるClaude Code超入門
448jp
7
8.2k
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
390
CSC307 Lecture 05
javiergs
PRO
0
490
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
120
ThorVG Viewer In VS Code
nors
0
760
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
5.9k
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
5.9k
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
230
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
110
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
140
CSC307 Lecture 02
javiergs
PRO
1
770
Featured
See All Featured
Docker and Python
trallard
47
3.7k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
220
Utilizing Notion as your number one productivity tool
mfonobong
2
210
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
61
52k
My Coaching Mixtape
mlcsv
0
45
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
230
What's in a price? How to price your products and services
michaelherold
247
13k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Typedesign – Prime Four
hannesfritz
42
2.9k
Google's AI Overviews - The New Search
badams
0
900
The untapped power of vector embeddings
frankvandijk
1
1.6k
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 ܕ͕ແ͍ੈքͷผͷػձʹ