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
ねことはじめる関数型 / functional programming with cats
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
ぷに
February 29, 2020
Technology
1
1.3k
ねことはじめる関数型 / functional programming with cats
VRC LT #7
ぷに
February 29, 2020
Tweet
Share
More Decks by ぷに
See All by ぷに
数値計算の呪いとあそぼぅ!!/ the curse of numerical calculus
punilfin
1
47
Other Decks in Technology
See All in Technology
クレジットカード決済基盤を支えるSRE - 厳格な監査とSRE運用の両立 (SRE Kaigi 2026)
capytan
6
2.6k
プロダクト成長を支える開発基盤とスケールに伴う課題
yuu26
4
1.3k
Cosmos World Foundation Model Platform for Physical AI
takmin
0
420
データ民主化のための LLM 活用状況と課題紹介(IVRy の場合)
wxyzzz
2
680
Agile Leadership Summit Keynote 2026
m_seki
1
530
広告の効果検証を題材にした因果推論の精度検証について
zozotech
PRO
0
140
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
5
1.5k
制約が導く迷わない設計 〜 信頼性と運用性を両立するマイナンバー管理システムの実践 〜
bwkw
3
890
外部キー制約の知っておいて欲しいこと - RDBMSを正しく使うために必要なこと / FOREIGN KEY Night
soudai
PRO
12
4.9k
CDKで始めるTypeScript開発のススメ
tsukuboshi
1
340
Oracle Cloud Observability and Management Platform - OCI 運用監視サービス概要 -
oracle4engineer
PRO
2
14k
Claude_CodeでSEOを最適化する_AI_Ops_Community_Vol.2__マーケティングx_AIはここまで進化した.pdf
riku_423
2
490
Featured
See All Featured
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
63
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
270
Un-Boring Meetings
codingconduct
0
200
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
200
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
730
A better future with KSS
kneath
240
18k
Done Done
chrislema
186
16k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
240
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Building an army of robots
kneath
306
46k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
350
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
580
Transcript
Ͷ͜ͱ͡ΊΔؔܕ ʹ (ehlfin_puni / punilfin) 2020/03/27
͜͡͠ΐ͏͔͍ ͳ·͑ɿʹ VRC ID : ehlfin_puni Twitter : punilfin 2020/02/10
ʹ VRC ʹ͖·ͨ͠ ͠ΐ͠Μ͠ΌͰ͢ɽͯ͘͞͠͠Ͷ ͖͢ɿ͢͏͕͘ ͖͚ͩ͢ͲͳʹΘ͔Βͳ͍Ͱ͢ɽͯ͘͞͠͠Ͷ ͖͢͡Όͳ͍ɿΖ͙ΒΈΜ͙ ͱ ͖͔͍͕͘͠Ύ͏ ͱ͘ʹ͖Β͍ɿ JavaScript
͍·͔Β Scala with Cats ͱ͍͏ຊͷΛ͠·͢ Cats Λμγʹͯؔ͠ܕͷߟ͑ํΛֶͿຊ Cats ʜ Scala
ͰΰϦΰϦؔܕ͢ΔͷΛิॿ͢ΔϥΠϒϥϦ Cats ͷ͍ํΛֶͿຊ
͜͜ʹ͋Γ·͢ Figure: https://underscore.io/books/scala-with-cats/
ಡΜͩܦҢ ͓͠͝ͱͰ Scala ͷϨϏϡʔΛ͠ͳ͍ͱ͍͚ͳ͍ Scala Βͳ͍ʂ ݍษڧ͚ͯͨ͠Ͳ Monad ͕ग़ͯ͘Δલʹ͖ͯΊͨ Monad
Βͳ͍ʂ ྆ํ·ͱΊͯษڧͰ͖ͳ͍͔ͳʁ
ຊͷষཱͯ Monoids and Semigroups Functors Monads Monad Transformers Semigroupal and
Applicative Foldable and Traverse Testing Asynchronous Code Map-Reduce Data Validation CRDTs ײ ාͦ͏
ಡΜͰΈͨײ ͋·Γා͘ͳ͍ Option, Future, List ͳͲɼScala ͰΑ͘͏֓೦ΛΑ͘ݟ͢ͱ͜Ζ͔Βελʔτ ͦΕΒͷڞ௨ੑ࣭ΛऔΓग़͢͜ͱͰ Monad ͳͲͷந֓೦ঃʑʹ
࠷ۙ͋ͬͨ͜ͱ Javascript ͷ࣭Λ͞Εͨ Γ͍ͨ͜ͱɿ ʮ2 ͭͷ Promise ͷ݁Ռ͕ग़ଗ͔ͬͯΒɺ2 ͭͷ݁ՌΛՃͯ͠ฦ͢ʯ ฉ͍ͨॠؒʹʮݴޠͷ
built-in ͚ؔͩͰͰ͖ͦ͏ͩʯͱࢥͬͨ ௐͨΒ Promise.all() ͕ώοτͨ͠
ਪաఔ ܕΫϥε F ʹରͯ͠ F[A] ͱ F[B] ͔Β F[A,B] ܕΛ࡞Γ͍ͨ
F ͕ Cartesian ͳΒ product ͰͰ͖Δ ͳͷͰ Promise ͕ Cartesian Ͱ͋Δ͜ͱΛࣔͤ OK Promise Scala Ͱ͍͏ͱ͜Ζͷ Future ͔ͩΒ Monad Ұൠʹ Monad ) Applicative ) Cartesian ͳͷͰ OK ೦ͳ͓Βͤ ͜ͷਪେ͖ͳ͕݀͋Δ Javascript ͷ Promise Monad Ͱͳ͍ Functor Ͱ͢Βͳ͍ Cartesian ʹݟ͑Δͷଟۮવ
ݸਓతʹࢥ͍ͬͯΔ͜ͱ ؔܕͷߟ͑ํ͕ʮৗʹਖ਼͍͠ʯΘ͚ͳ͍ ͕ɼ ʮؔܕҎ֎ؔܕͷߟ͑ํ͕͑ͳ͍ʯͷ͔ʁ Ͳ͜·Ͱʢແཧͳ͘ʣ௨༻͢Δ͔ߟ͍͑ͨ ʢཧʣֶ͔Βٕज़ാʹೖͬͨࢲʹͱͬͯɼ ʮֶͬΆ͍ߟ͑ํ͕͑Δ͜ͱʯཧղΛ͛ Δ্Ͱେ͖ͳॿ͚ʹͳΔ
·ͱΊ Figure: Cats ͷΛ͠·ͨ͠ɽࣸਅ࣮ՈͷͶ͜Ͱ͢ɽ