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
68
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Fun of Types
Ryosuke TAKASHIMA
February 22, 2019
More Decks by Ryosuke TAKASHIMA
See All by Ryosuke TAKASHIMA
GCP native cloud migration
rst76
1
560
Cloud migration of the essential service
rst76
1
630
About purely functional language
rst76
0
160
performance-tuning-of-the-microservice.pdf
rst76
0
1.6k
red-black-tree.pdf
rst76
0
95
Understanding Subtype in 5 Minutes
rst76
0
200
Embedded Probabilistic Programming
rst76
0
400
Other Decks in Programming
See All in Programming
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
240
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
720
React本体のコードリーディング
high_g_engineer
1
150
バグを直したら useEffect が消えた
colorful12
3
660
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
340
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
670
進化を続けるGo toolsの現在地 / The Current State of Ever-Evolving Go Tools
hond0413
0
240
そこに3びきプロダクトがいるじゃろう——生成AI時代における“価値が届かない理由”の構造
kosuket
0
530
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
350
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
280
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
220
freeeにおけるEvalsの実践例の紹介
freee
PRO
0
130
Featured
See All Featured
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
720
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
210
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Exploring anti-patterns in Rails
aemeredith
3
470
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
250
Making the Leap to Tech Lead
cromwellryan
135
10k
Docker and Python
trallard
47
4.1k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.4k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Bash Introduction
62gerente
615
220k
So, you think you're a good person
axbom
PRO
2
2.1k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
630
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 ܕ͕ແ͍ੈքͷผͷػձʹ