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
760
怖くないCats
Jun Tomioka
October 15, 2018
Tweet
Share
More Decks by Jun Tomioka
See All by Jun Tomioka
Dotty で軽量な DI ライブラリをかいてみた
jooohn
1
300
ソフトウェアエンジニアとしてモナドを完全に理解する / make-perfect-sense-of-monad
jooohn
14
7.6k
ScalaのコンパイラにFizzBuzzを解いてもらう(Dottyもあるよ)
jooohn
1
980
Write stack safe non-tailrec recursive functions
jooohn
4
900
Introduction to Clean Architecture
jooohn
1
540
人類には早すぎる、謎の計算ロジックに立ち向かう / Strugle with the most complicated logic ever
jooohn
1
1.6k
Work at M3 USA
jooohn
0
1.2k
クラウド電子カルテを支えるテクノロジーの光と闇
jooohn
0
1.2k
Scalaの型クラスを完全に理解する
jooohn
5
1.8k
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
366
25k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
9
500
Thoughts on Productivity
jonyablonski
69
4.5k
YesSQL, Process and Tooling at Scale
rocio
172
14k
The Pragmatic Product Professional
lauravandoore
32
6.4k
Testing 201, or: Great Expectations
jmmastey
42
7.2k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.6k
A designer walks into a library…
pauljervisheath
205
24k
Faster Mobile Websites
deanohume
306
31k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.3k
Fontdeck: Realign not Redesign
paulrobertlloyd
83
5.4k
Documentation Writing (for coders)
carmenintech
67
4.6k
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エンジニアとして学んでいて楽しい。 ▪ 汎用的で腐りにくい抽象化の知識。 • とはいえ、濫用には注意 ◦ 使ったほうがコードが理解しやすい / 堅牢になるといった場面で使うべき。 ▪ 『ハンマーを持つ人には全てが釘に見える』に注意。 ◦ 自分やチームメンバーの理解を超えて使わない。 ▪ 無理して使うものではない。