Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 01:18
    johnynek commented #9635
  • 01:07
    lihaoyi commented #9635
  • 00:57
    lihaoyi synchronize #9635
  • 00:54
    retronym commented #9633
  • May 16 22:12
    kubukoz synchronize #2011
  • May 16 21:46
    smarter commented #12396
  • May 16 21:43
    dwijnand closed #12396
  • May 16 21:43
    dwijnand commented #12396
  • May 16 21:02
    casperlehmann commented #2019
  • May 16 21:00
    casperlehmann opened #2024
  • May 16 17:11
    joroKr21 commented #9635
  • May 16 17:09
    joroKr21 commented #9635
  • May 16 17:06
    rtyley edited #12396
  • May 16 17:04
    joroKr21 commented #9635
  • May 16 15:17
    lihaoyi commented #9635
  • May 16 15:16
    lihaoyi commented #9635
  • May 16 14:28
    dwijnand commented #9635
  • May 16 14:26
    lihaoyi synchronize #9635
  • May 16 14:23
    lihaoyi commented #9635
  • May 16 13:41
    lihaoyi edited #9635
Klas Segeljakt
@segeljakt
"So here we have the crux of the problem — we can have first-class monomorphic function values and we can have second-class polymorphic methods, but we can’t have first-class polymorphic function values … at least we can’t with the standard Scala definitions. And yet it’s first-class polymorphic function values that we need to map over an HList … what to do?"
Fabio Labella
@SystemFw
no, first class polymorphism is a different thing
Klas Segeljakt
@segeljakt
ok
Fabio Labella
@SystemFw
it's a more advanced topic
but it's got nothing to do with what you are talking about
Martijn Hoekstra
@martijnhoekstra
@hrhino don't you give me that nme pos tpe app pt qual tr gobbledygook - I run Windows and I'm pretty sure those are just part of GNU powertools
Harrison Houghton
@hrhino
watch me. you get lhs and sel too
and my favourite, mk
Klas Segeljakt
@segeljakt
Ok, I’m wondering, how would you define what an HList is
Fabio Labella
@SystemFw
in what sense?
Klas Segeljakt
@segeljakt
compared to a regular List
Martijn Hoekstra
@martijnhoekstra

No command 'sel' found, but there are 18 similar ones

oh, thanks Bash. That's helpful.

Fabio Labella
@SystemFw
@klassegeljakt a heterogenous list
Klas Segeljakt
@segeljakt
Ok, compared to a List it preserves type information of each element. Compared to a Tuple, it abstracts over arity
Justin du Coeur, AKA Mark Waks
@jducoeur
Correct.
Klas Segeljakt
@segeljakt
is it “arity polymorphic”?
or do you call it something else
Fabio Labella
@SystemFw
it doesn't really abstract over arity on its own
it just happens to have an inductive structure
and one can use typeclasses to "abstract over arity"
But I wouldn't call an HList arity polymorphic, personally
Klas Segeljakt
@segeljakt
ok
Seth Tisue
@SethTisue
normally when we say “arity” we’re talking about functions
idk, I guess we say it about tuples
Klas Segeljakt
@segeljakt
is it
def foo[<kinds>](<arity>) = …
Seth Tisue
@SethTisue
as Fabio indicates, an HList is really just a series of nested tuples of arity 2
Fabio Labella
@SystemFw
kinds there also doesn't make sense :)
those are type parameters
a kind is a different thing
btw I can explain most of those terms if you want, I just don't want to throw a ton of info at you at once
Ichoran
@Ichoran
Arity just means "how many arguments". It doesn't tell you whether they are type arguments or value arguments.
Or what you pack them into.
Klas Segeljakt
@segeljakt
I should not have wrote it like that
1-kind: Foo[A]
2-kind: Foo[A,B]
3-kind: Foo[A,B,C]
…?
Fabio Labella
@SystemFw
ehm, kind of
no pun intended
Klas Segeljakt
@segeljakt
lol
Fabio Labella
@SystemFw
your notation is too imprecise
the 1-kind, 2-kind thing
Ichoran
@Ichoran
Mathematical vectors have arity, for instance. v = (a, b) is a 2-ary vector.
Klas Segeljakt
@segeljakt
(y)
How would you explain kinds?
Fabio Labella
@SystemFw
it cannot distinguish between Either[A, B] and Free[F, R] (the F there can be IO, not Int, whereas the A in Either can be IO[Int], or String, but not IO)
that's the explanation I use for kinds
first of all, talking about kinds in Scala is a bit weird, the notation is not great
so I'm going to use Haskell notation, which is std, and show you the translation to scala
basically it starts with types
a type is a compile time label that's attached to a term (a term is a value like 1 or "hello" or map), which can be used to statically prove the absence of certain behaviour
Ichoran
@Ichoran
Haskell notation is basically the optimal notation for talking about types, anyway. It's like someone took that notation and built a programming language around it.
Fabio Labella
@SystemFw
or in layman terms, a type is a way of classifying value (but try to understand the definition above, because that's the correct one)
similarly, there are labels to classify types themselves