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
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
oxlintはeslint/typescript-eslintを置き換えられるのか
shomafujita
2
320
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
4.2k
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
190
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
350
CLIであることを活かしたGitHub Copilot CLI活用術 / GitHub Copilot CLI Pro Tips & Tricks
nao_mk2
1
1.2k
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.1k
柔軟なPDFレイアウトエディタを支える型システム設計 — Discriminated UnionとConditional Typeの実践
minako__ph
4
1.4k
The Arts and Crafts of Work in the AI Era — Toward Mastery in Software Development
kuranuki
1
720
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
630
New "Type" system on PicoRuby
pocke
1
470
AI 時代のソフトウェア設計の学び方
masuda220
PRO
29
12k
These Five Tricks Can Make Your Apps Greener, Cheaper, & Nicer
hollycummins
0
270
Featured
See All Featured
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
830
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
380
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
240
The agentic SEO stack - context over prompts
schlessera
0
790
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
160
Leo the Paperboy
mayatellez
7
1.8k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
360
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
190
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 ܕ͕ແ͍ੈքͷผͷػձʹ