Types, Kinds and Type Constructors in Scala | Rock the JVM

  Рет қаралды 6,543

Rock the JVM

Rock the JVM

Күн бұрын

Пікірлер
@daniellopes6874
@daniellopes6874 4 жыл бұрын
Next stop: type lambdas and partially applied types, which I personally still find hard to grasp. Some people refer to type constructors as types with holes you need to fill to get a well formed type. As you mentioned lifting functions mentally to the type level can help understand the concepts. What I found interesting about generics and generic functions in particular is that they limit the possible implementations and help alot when it comes to reasoning by only looking at the types.
@rockthejvm
@rockthejvm 4 жыл бұрын
Yep - type lambdas coming in the next video tomorrow!
@ravisubramanian919
@ravisubramanian919 2 жыл бұрын
Superb explanation! Thank you!
@joan38
@joan38 4 жыл бұрын
Really good videos. Super clear, super detailed.
@rockthejvm
@rockthejvm 4 жыл бұрын
Glad to hear it!
@HPA97
@HPA97 Жыл бұрын
Great explanation!
@jogatavid
@jogatavid 4 жыл бұрын
What an incredible explanation thank you
@rockthejvm
@rockthejvm 4 жыл бұрын
Happy it clicked!
@PlatinumDragonProductions999
@PlatinumDragonProductions999 3 жыл бұрын
Thank you for all of your Scala videos, I am learning a lot from them :-)
@rockthejvm
@rockthejvm 3 жыл бұрын
Glad they're useful!
@dhirendrapandit5530
@dhirendrapandit5530 4 жыл бұрын
I loved this explanation
@rockthejvm
@rockthejvm 4 жыл бұрын
Glad you liked it!
@ThePyroJoke
@ThePyroJoke 4 жыл бұрын
Awesome video! Almost a super power of explaining complex abstract stuff in simple words :) One question to clarify: when you defined functorList as new Functor[List] that became level-1 type or level-0 type?
@rockthejvm
@rockthejvm 4 жыл бұрын
If you can attach it to a value, that's a level-0 type in this terminology.
@daniellopes6874
@daniellopes6874 4 жыл бұрын
I think they call it proper type or value type but I like your level scheme more intuitive. If you need a good reading before going to sleep 😬 scala-lang.org/files/archive/spec/2.13/03-types.html
@pr0master
@pr0master 4 жыл бұрын
Amazing video, thank you very much!!
@rockthejvm
@rockthejvm 4 жыл бұрын
Glad you liked it!
@AmitPrasadbangalore
@AmitPrasadbangalore 3 жыл бұрын
Thank you Daniel, this is very crisp and clear , however I'm just wondering for Option[Seq[]] , why my code is not compiling It is something like trait CustomContainer[F[C[_]]] { def filterByQueryParameters[A, B](container: F[A])(f: A => B): F[B] } But this is not working for Option[Seq[CaseClass]], could you please spot what I'm missiing here. Thanks
@aviadshiber6232
@aviadshiber6232 4 жыл бұрын
Great explanation! can you explain in other videos on shapeless?
@rockthejvm
@rockthejvm 4 жыл бұрын
Noted - will have something on shapeless as well
@anticipayo
@anticipayo 4 жыл бұрын
Can you put out a video that explains the placeholder ? or * for higher kind types as supposed to _? Thanks for the video
@rockthejvm
@rockthejvm 4 жыл бұрын
Those placeholders will probably not be needed too much now with proper type lambda syntax in Scala 3 kzbin.info/www/bejne/mGKmaayYgdWti8U
@TheProximator
@TheProximator 4 жыл бұрын
Very nice video, waiting next :)
@kevalan1042
@kevalan1042 4 жыл бұрын
What would be awesome is to give code examples where a higher level type can simplify a codebase
@rockthejvm
@rockthejvm 4 жыл бұрын
A subject for some 2-hour video! This would require some longer-form tutorial.
@imranhossainfaruk5445
@imranhossainfaruk5445 4 жыл бұрын
Hi Daniel, Thanks a lot for the nice video. I am confused about a particular scenario, I have tried to summarize the scenario in dummy code( it does not compile). Could you please help me understand how can the scenario be achieved? trait GenericFlatten[F[G[T]]]{ // sample concrete type List[Set[Int]] or Seq[List[String]] def flatten(input: F[G[T]]): F[T] // F[G[T]] => List[Set[Int]] , F[T] => List[Int] } implicit object GenericFlattenListSetInt extends GenericFlatten[List[Set[Int]]]{ override def flatten(input: List[Set[Int]]): List[Int] = input.flatMap(_.toList) } def getFlattenCollection[F[G[T]]](input : F[G[T]])(implicit gf : GenericFlatten[F[G[T]]]): F[T] ={ gf.flatten(input) } val listOfSet: List[Set[Int]] = List(Set(1,2), Set(2,3)) val flattenList = getFlattenCollection(listOfSet) // expected output is 1,2,2,3
@rockthejvm
@rockthejvm 4 жыл бұрын
Hi Imran, it's certainly possible, only that you can't pass all the type arguments nested like that. You can do this: trait GenericFlatten[F[_], G[_], T] { def flatten(input: F[G[T]]): F[T] } implicit object GenericFlattenListSetInt extends GenericFlatten[List, Set, Int]{ override def flatten(input: List[Set[Int]]) = input.flatMap(_.toList) } def getFlattenCollection[F[_], G[_], T](input : F[G[T]])(implicit gf : GenericFlatten[F, G, T]): F[T] ={ gf.flatten(input) }
@imranhossainfaruk5445
@imranhossainfaruk5445 4 жыл бұрын
@@rockthejvm Thank you very much, Daniel.
@hotharvey2
@hotharvey2 Жыл бұрын
So, considering an Option[+A] - where I can create an Option[List[Int]], would it be correct that Option[+A] is only a level 1 type because the API of Option never interacts with the inner type?
@rockthejvm
@rockthejvm Жыл бұрын
It's a "level-1" type in the video, yes - not sure what you mean by "never interacts with the inner type".
@hotharvey2
@hotharvey2 Жыл бұрын
@@rockthejvm Thank you. I mean that no method on Option will need to call any method on the Int, only the List
@RobinHillyard
@RobinHillyard 2 жыл бұрын
Good description but you might want to show what you can actually do with something like your functorList.
@RomanArkharov
@RomanArkharov 4 жыл бұрын
Thank you for the video and light theme in IDE :)
@WA9NNN
@WA9NNN Жыл бұрын
I find the light theme much easier to read. Thanks.
@robert33232
@robert33232 3 жыл бұрын
HashMap - why not just call it Dict? 🙂
Variance Positions in Scala, Demystified | Rock the JVM
31:58
Rock the JVM
Рет қаралды 8 М.
Type Lambdas in Scala 3 | Rock the JVM
18:07
Rock the JVM
Рет қаралды 7 М.
Жездуха 41-серия
36:26
Million Show
Рет қаралды 5 МЛН
#behindthescenes @CrissaJackson
0:11
Happy Kelli
Рет қаралды 27 МЛН
ВЛОГ ДИАНА В ТУРЦИИ
1:31:22
Lady Diana VLOG
Рет қаралды 1,2 МЛН
Value Classes in Scala | Rock the JVM
22:27
Rock the JVM
Рет қаралды 5 М.
What the Functor? | Functors in Scala | Rock the JVM
24:43
Rock the JVM
Рет қаралды 12 М.
Semigroups and Monoids in Scala
23:05
Rock the JVM
Рет қаралды 6 М.
Contravariance in Scala: Why Is It So Hard? | Rock the JVM
16:24
Rock the JVM
Рет қаралды 15 М.
Algebraic Data Types (ADT) in Scala | Rock the JVM
14:19
Rock the JVM
Рет қаралды 10 М.
Scala Generics: A Gentle Introduction
23:48
Rock the JVM
Рет қаралды 7 М.
Scala 3: Traits, New Features | Rock the JVM
17:08
Rock the JVM
Рет қаралды 8 М.
Type-Level Programming in Scala, part 1 | Rock the JVM
25:27
Rock the JVM
Рет қаралды 16 М.
Free Monad in Scala
40:04
Rock the JVM
Рет қаралды 9 М.
Жездуха 41-серия
36:26
Million Show
Рет қаралды 5 МЛН