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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Ryosuke TAKASHIMA
February 22, 2019
Programming
63
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
550
Cloud migration of the essential service
rst76
1
620
About purely functional language
rst76
0
160
performance-tuning-of-the-microservice.pdf
rst76
0
1.6k
red-black-tree.pdf
rst76
0
94
Understanding Subtype in 5 Minutes
rst76
0
190
Embedded Probabilistic Programming
rst76
0
390
Other Decks in Programming
See All in Programming
Webフレームワークの ベンチマークについて
yusukebe
0
130
Oxcを導入して開発体験が向上した話
yug1224
4
290
TypeSpec で繋ぐ複数プロダクトの型安全
maroon8021
1
400
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
630
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
6
830
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
540
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
220
Inside Stream API
skrb
1
640
AI駆動開発勉強会 広島支部 第一回勉強会 AI駆動開発概要とワークショップ
hayatoshimiu
0
450
AIとRubyの静的型付け
ukin0k0
0
540
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.2k
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
230
Featured
See All Featured
Thoughts on Productivity
jonyablonski
76
5.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.1k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
820
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
GitHub's CSS Performance
jonrohan
1033
470k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
220
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
160
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
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 ܕ͕ແ͍ੈքͷผͷػձʹ