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
怖くないCats
Search
Jun Tomioka
October 15, 2018
0
790
怖くないCats
Jun Tomioka
October 15, 2018
Tweet
Share
More Decks by Jun Tomioka
See All by Jun Tomioka
Dotty で軽量な DI ライブラリをかいてみた
jooohn
1
320
ソフトウェアエンジニアとしてモナドを完全に理解する / make-perfect-sense-of-monad
jooohn
14
7.6k
ScalaのコンパイラにFizzBuzzを解いてもらう(Dottyもあるよ)
jooohn
1
1k
Write stack safe non-tailrec recursive functions
jooohn
4
920
Introduction to Clean Architecture
jooohn
1
550
人類には早すぎる、謎の計算ロジックに立ち向かう / Strugle with the most complicated logic ever
jooohn
1
1.7k
Work at M3 USA
jooohn
0
1.3k
クラウド電子カルテを支えるテクノロジーの光と闇
jooohn
0
1.3k
Scalaの型クラスを完全に理解する
jooohn
5
1.9k
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.6k
Product Roadmaps are Hard
iamctodd
PRO
52
11k
What's in a price? How to price your products and services
michaelherold
245
12k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
135
33k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
5
570
VelocityConf: Rendering Performance Case Studies
addyosmani
329
24k
Designing for Performance
lara
608
69k
Typedesign – Prime Four
hannesfritz
41
2.6k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
178
53k
Transcript
怖くない Cats @jooohn1234
M3, Inc. @jooohn1234 • じょん と呼んでください • エムスリーのエンジニア ◦ Scala
・ FP 好き ◦ 猫2匹と同居
None
None
None
None
None
None
None
None
None
モナドは プログラム可能な セミコロン!!
やばい世界に 足を踏み入れて しまった
None
None
None
None
完全にこわい
None
None
None
None
None
None
None
None
None
None
Catsは 怖くない!
Motivations • Approachability • Modularity • Documentation • Efficiency
Motivations • Approachability • Modularity • Documentation • Efficiency
Motivations • Approachability • Modularity • Documentation • Efficiency ドキュメントが充実していて
とっつきやすい!
Monoid
None
None
None
None
None
二項演算 (Int, Int) => Int 単位元 Int
二項演算 (Int, Int) => Int 単位元 Int こういう感じの性質を 持っているやつが Monoid
注:ざっくりした説明です
例でなんとなく理解するMonoid (厳密には Monoid lawsを参照) Monoid 単位元 (empty) 二項演算 (combine) 例
Int の 加算 0 + 0 + 1 + 2 + 0 = 3 Int の 乗算 1 * 1 * 3 * 5 * 1 = 15 List の 連結 Nil ::: Nil ::: List(3) ::: List(5, 8) ::: Nil = List(3, 5, 8)
Monoid laws law Intの加算 の例 (a combine b) combine c
= a combine (b combine c) (1 + 2) + 3 = 6 1 + (2 + 3) = 6 empty combine a = a 0 + 1234 = 1234 a combine empty = a 1234 + 0 = 1234
なんかわかるきがする!
・・・
それで なにがうれしいんだっけ
None
None
None
None
みたことあるきがする
None
None
こういうときある
こういうときある
None
なんかややこしい
None
Monoidはつくれる!
None
全てのMonoidに対して Foldable#foldMapが使える
None
・・・
ほとんど Int と同じなのに めんどうだなあ
None
None
None
Int と Price は値を変えずに交換可能
None
None
None
None
None
None
便利!
雑感 • Cats は怖くないし便利! ◦ Approachability / Documentation ▪ ドキュメントを読み進めながら学習が進む。
◦ 便利と思ったものだけ使えば良い ▪ 自分やチームの成長とともに徐々に扱う範囲を増やしていける。 ◦ 1エンジニアとして学んでいて楽しい。 ▪ 汎用的で腐りにくい抽象化の知識。 • とはいえ、濫用には注意 ◦ 使ったほうがコードが理解しやすい / 堅牢になるといった場面で使うべき。 ▪ 『ハンマーを持つ人には全てが釘に見える』に注意。 ◦ 自分やチームメンバーの理解を超えて使わない。 ▪ 無理して使うものではない。