Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improving definitions for monoid, comonad, applicative, and ADT #230

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jethrolarson
Copy link
Collaborator

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

@jethrolarson
Copy link
Collaborator Author

@hemanth :shipit: ?

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'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any other alternatives? @jethrolarson 🤓

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Infinitely many, but why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured playing cards were something that a lot of people are familiar with whose instances are a product of two sets.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant instead of using ts :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hindley-milner for consistence, sure! Thanks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My reticence is then that these named types have no representation in value-space and thus may make no sense in JS.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nods, but hindley-milner would be bit more consistent?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants