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
970
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
Optimising Largest Contentful Paint
csswizardry
34
3.1k
Side Projects
sachag
452
42k
Site-Speed That Sticks
csswizardry
4
380
Why Our Code Smells
bkeepers
PRO
336
57k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
We Have a Design System, Now What?
morganepeng
51
7.4k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
The Invisible Side of Design
smashingmag
299
50k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
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エンジニアとして学んでいて楽しい。 ▪ 汎用的で腐りにくい抽象化の知識。 • とはいえ、濫用には注意 ◦ 使ったほうがコードが理解しやすい / 堅牢になるといった場面で使うべき。 ▪ 『ハンマーを持つ人には全てが釘に見える』に注意。 ◦ 自分やチームメンバーの理解を超えて使わない。 ▪ 無理して使うものではない。