Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 00:18

    eed3si9n on main

    显示 -> 显式 Hello, I am a chinese… Merge pull request #2185 from f… (compare)

  • 00:18
    eed3si9n closed #2185
  • Sep 21 21:45
    SethTisue synchronize #1491
  • Sep 21 21:43
    SethTisue synchronize #1488
  • Sep 21 21:43

    SethTisue on 2.13.x

    2.13: add catbird (#1490) (compare)

  • Sep 21 21:43
    SethTisue closed #1490
  • Sep 21 21:22
    SethTisue edited #1490
  • Sep 21 21:21
    SethTisue synchronize #1490
  • Sep 21 21:09
    SethTisue synchronize #1491
  • Sep 21 21:07
    SethTisue synchronize #1491
  • Sep 21 21:05
    SethTisue converted_to_draft #1489
  • Sep 21 21:05
    SethTisue commented #1489
  • Sep 21 21:04
    SethTisue edited #1491
  • Sep 21 21:04
    SethTisue labeled #1491
  • Sep 21 21:04
    SethTisue assigned #1491
  • Sep 21 21:04
    SethTisue opened #1491
  • Sep 21 20:59
    SethTisue edited #1488
  • Sep 21 20:58
    SethTisue synchronize #1488
  • Sep 21 20:55
    SethTisue edited #1490
  • Sep 21 20:54
    SethTisue labeled #1490
trepidacious
@trepidacious
@jmcardon I think I'm ok on that, we just ended up talking about two things at once, I didn't know about type constructors versus data constructors though
Fabio Labella
@SystemFw
that's also a type constructor
but can't be a functor
Either a can
Jose C
@jmcardon
b-b-b-b-bifunctor!
trepidacious
@trepidacious
Ah because it has two type paramters
Fabio Labella
@SystemFw
so I'd recommend just talking in terms of kinds
it's way more precise
trepidacious
@trepidacious
Is that * -> * -> * then?
Fabio Labella
@SystemFw
yeah
and in haskell types and "type constructors" have the same representation anyway
trepidacious
@trepidacious
How do I pronounce *->*?
Fabio Labella
@SystemFw
the term "type constructor" is imho only useful when explaining the difference with "data constructors"
star to star
that's how I do it
Rich
@Rich2
Could you implement Option in terms of Either?
type Option[A] = Either[Unit, A]
type Some[A] = Right[Unit, A]
val None = Left[Unit, Nothing](Unit)
Fabio Labella
@SystemFw
you can also say Type to Type but it's more confusing since you are saying type a lot as well
trepidacious
@trepidacious
Makes sense. So that is kind of a single parameter function on types?
Fabio Labella
@SystemFw
yeah, pretty much
with the usual caveats wrt to currying
Jose C
@jmcardon
star to star :P
jk
@Richtype yeah
trepidacious
@trepidacious
I should read up on the data constructor thing, but approximately Just and Nothing are ways of getting a value of type Maybe, but that does not make them types themselves?
Jose C
@jmcardon
you can
Option is essentially Either with less information
Fabio Labella
@SystemFw
@trepidacious yes
Jose C
@jmcardon
you discard the information on the left parameter
Fabio Labella
@SystemFw
Some and Nothing do two things
Jose C
@jmcardon
and you can implement option
trepidacious
@trepidacious
Sorry of type Maybe a I guess
Fabio Labella
@SystemFw
one) they construct values of type Maybe a
two) they are runtime tags that are used to do runtime dispatch (pattern matching)
trepidacious
@trepidacious
@SystemFw So in Scala terms a constructor and an unapply?
Fabio Labella
@SystemFw
yeah
well, they literally are tags
that are part of the runtime representation
trepidacious
@trepidacious
Like in a tagged union?
Fabio Labella
@SystemFw
kind of like python "types"
yes, pretty much
trepidacious
@trepidacious
Thanks that's much clearer, I would probably have tripped over that later :)
Fabio Labella
@SystemFw
types are compile time labels that are used to statically prove the absence of certain behaviour
tags are runtime labels that inform you about a specific data representation in memory
when python (or any other "strongly typed" untyped language) programmers talk about types
those aren't types, they are tags
trepidacious
@trepidacious
I guess they are kind of types if the set of behaviours you check for is empty ? ;)
Fabio Labella
@SystemFw
well, you jest
but one view of untyped languages
trepidacious
@trepidacious
Vacuously typed! It's the new thing :)
Fabio Labella
@SystemFw
is that they are actually unityped
so, everything has one type (e.g Object or whatever), with lots of tags (Int, String, Dict or whatever)
btw this is loosely related to the class vs type distinction in OO