Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 05 2019 14:43
    @typelevel-bot banned @jdegoes
  • Jan 31 2019 21:17
    codecov-io commented #484
  • Jan 31 2019 21:08
    scala-steward opened #484
  • Jan 31 2019 18:19
    andywhite37 commented #189
  • Jan 31 2019 02:41
    kamilongus starred typelevel/cats-effect
  • Jan 30 2019 00:01
    codecov-io commented #483
  • Jan 29 2019 23:51
    deniszjukow opened #483
  • Jan 29 2019 23:37
  • Jan 29 2019 23:22
  • Jan 29 2019 20:26
    Rui-L starred typelevel/cats-effect
  • Jan 29 2019 18:01
    jdegoes commented #480
  • Jan 29 2019 17:04
    thomaav starred typelevel/cats-effect
  • Jan 28 2019 17:43
    asachdeva starred typelevel/cats-effect
  • Jan 28 2019 07:12
    alexandru commented #480
  • Jan 28 2019 05:45
    codecov-io commented #482
  • Jan 28 2019 05:35
    daron666 opened #482
  • Jan 27 2019 13:56
    codecov-io commented #481
  • Jan 27 2019 13:46
    lrodero opened #481
  • Jan 27 2019 05:47
    codecov-io commented #460
  • Jan 27 2019 05:37
    codecov-io commented #460
Gavin Bisesi
@Daenyth
The outer F[F[A]] is "create shared state to store memoization"
The inner F[A] is "read or populate the shared memoization state"
If you flatten it, you get "create shared state for memoization, then immediately populate it, and discard the access to the state"
Rafi Baker
@BakerRafi_twitter
I had to read that a couple of times but I think I get it now. Thanks :)
Steven Fines
@sfines-clgx
I am about to ask a really stupid question.
like, it should be capitalized
Real Stupid Question
I've been coming at cats piecemeal, and the one thing I never really see explained is F[_]
I believe that it is supposed to be some sort of typed function but am not really sure enough to stake my life one it
am I correct, and if not, where can I become less stupid about this in the future?
Fabio Labella
@SystemFw
you are not quite right, but the question is not stupid at all
do you want to know what F[_] means in terms of language feature
or the point of the pattern? (and what the pattern is, how it works)
Steven Fines
@sfines-clgx
well, I get that the _ is a wildcard type
Fabio Labella
@SystemFw
ah, it's not
Steven Fines
@sfines-clgx
ok, then maybe we should start there
Fabio Labella
@SystemFw
scala 2 syntax is confusing in that respect (and it's thankfully changing in scala 3), but it's not a wildcard
Steven Fines
@sfines-clgx
I feel I probably need to know both
Fabio Labella
@SystemFw
right, let's start from there then
have you ever heard the word kind?
in the context of type systems, of course :smile:
Steven Fines
@sfines-clgx
not enough to clearly re-define it
Fabio Labella
@SystemFw
ok, let's go through that quickly, so
Steven Fines
@sfines-clgx
I sort of have the idea of higher-kinded types being types that define types
Fabio Labella
@SystemFw
yeah, that is quite correct
and in short F[_] is a higher kinded type parameter
but we can make it more precise if you want
Steven Fines
@sfines-clgx
for the sake of argument, let's leave it at that and I can do some googling if needed
Fabio Labella
@SystemFw
so basically, just as we use types to classify terms ("hello" can be classified as String, 3 can be classified as Int and so on), we use kinds to classify types
whoops, already started :)
Steven Fines
@sfines-clgx
keep going
no need to backtrack now
Fabio Labella
@SystemFw
the classification of types with kinds is fairly simple
you have types of kind * (pronounced star, or type)
these are types that don't need any extra information
e.g. Int String Option[Int], Option[List[Either[String, Int]]] etc
but some types do need extra information
Steven Fines
@sfines-clgx
k
Fabio Labella
@SystemFw
for example Option, defined as Option[A], needs to know what A is
in other words, Option has kind * -> *, because it requires a proper type (say Int), and it gives you another proper type Option[Int]
Either is of kind * -> * -> * (they are curried, so you can think of it as having two arguments)
Steven Fines
@sfines-clgx
because it takes a single proper type and returns a coproduct of two types?
Fabio Labella
@SystemFw
because it needs to have two proper types as arguments, to give you a proper type, say Int and String, and it gives you Either[Int, String]
Steven Fines
@sfines-clgx
ok
Fabio Labella
@SystemFw
just like a curried function Int => Int => Int can be seen as taking two ints
this language is quite rich, e.g. the kind of Resource is (* -> *) -> * -> *
it takes a first argument of kind * -> * and a second of kind * and it gives you something of kind *
e.g. Resource[IO, Int]
Steven Fines
@sfines-clgx
in this context -> is sort of a mapping operator?
Fabio Labella
@SystemFw
it's like a function in this notation (this is haskell notation, I'm going to show you the scala one in a sec)
a function on types, almost