http4sとcats-effectで可愛らしい、関数型らしいアプリケーションを書こう!٩(๑^o^๑)۶
http4scats-effect ٩(๑^o^๑)۶
View Slide
2Hello!!!#Scala" %(&) '$ ZOZO Tech
● ● cats effect ● http4s ● Tagless final +..+♪(●’∀’●)♪+..+3
● ● dysangelist/scala_kansai_demo@github+..+♪(●’∀’●)♪+..+4
1
Scala(/0#+ ● #+-7Java2.6,3" 8● '$%7 148● 57&)*)!!8● 6
● ● ● 7
01(*.)-4● *. #'+● %-!*./● &$,"328
Cats Effect2
Cats Effect● 723Cats8.IO)%$:1"'*!5/*&*+-● 9ZIOHaskellIOMonix Task6● Type Level04(,# 10
!Future-● Future#(Future **)● &$Futureside-effectful● %()" ! ! !● +left identity ',11
http4s3
http4s● Fs2IO http (Framework● Service As KleisliServer As Stream13
+<● Play! $' !API-)#)%!!!● Finagle – Twitter Future/1● Finch - ↑ :58Effect23 .*4 9;● AkkaHTTP ← Spray,6.7● Colossus ???? &("<● Chaos ??? 0<14
Tagless final4
Tagless Final● $'%End Of The World ● " (Eff, Free● ↑ !16
● Principle of Least Power● ● 17
Application5
-26*7● % $!& "'#5 345(+2● ),persistence.in memoryHashMap)08DB91/'# :https://github.com/dysangelist/scala_kansai_demo19
20●
Algebra①21● %#)! '● Type"$&(
Algebra②22
Algebra③23● *(Algebra'"$ &%#!+● -.Aggregate-DDD, ) .
Algebra④24
Logic①25● Logic, Algebra
Logic②26
27
②28● Service/Router Logic
③29
④30● !!
31
Representation32● Algebra
Representation②33● InMemory
Representation③34● InMemory
● HttpService[F]Kleisli[OptionT[F, ?], Request[F], Response[F]]alias● IntelliJcombineK Service?35
36
437● FW%#%&(),1.Separationof Concerns ● "!'$ 03/● http4sOpinionated 2*● +-
38~fin~Any questions?