improving definitions for monoid, comonad, applicative, and ADT#230
improving definitions for monoid, comonad, applicative, and ADT#230jethrolarson wants to merge 1 commit intomasterfrom
Conversation
|
@hemanth |
| It's called a product because the total possible values of the data structure is the product of the different values. | ||
|
|
||
| ```ts | ||
| type Rank = 'A' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | 'J' | 'Q' | 'K' |
There was a problem hiding this comment.
Infinitely many, but why?
There was a problem hiding this comment.
I figured playing cards were something that a lot of people are familiar with whose instances are a product of two sets.
There was a problem hiding this comment.
Oh, it's a concept that only exists in type space so some kind of type syntax is necessary to describe it. Hmm I don't know how this would be represented in the pseudo-type system this document uses.
In F# which is a hindley-milner system it'd be something like
type Rank = A | Two | Three | Four | Five | Six | Seven | Eight | Nine | Ten | J | Q | K
type Suit = Spades | Hearts | Clubs | Diamonds
type Card = Rank * Suit
Is that better?
There was a problem hiding this comment.
hindley-milner for consistence, sure! Thanks.
There was a problem hiding this comment.
My reticence is then that these named types have no representation in value-space and thus may make no sense in JS.
There was a problem hiding this comment.
nods, but hindley-milner would be bit more consistent?
Addressing some of the feed back in #220
I looked at "Lift" and while I can see that our definition is more general than "lambda lifting" I kinda prefer that the idea be generalized to all values not just functions. That I think make it easier to teach the idea of computation contexts in the way that Scott W does with the elevated worlds metaphor