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

Update kinds, add newer syntaxes, notes #75

Merged
merged 9 commits into from May 11, 2017

Conversation

Projects
None yet
6 participants
@MonoidMusician
Copy link
Contributor

commented May 9, 2017

Replaces #74, just cleaned up the ugly commits.

MonoidMusician added some commits May 9, 2017

Nested records
Fixes #18. Todo: Unify with Records.md?
Expand section on type synonyms
The example involving `one` did not type check. Now it does. Maybe it would be helpful to think of real-world examples for type synonyms and use those here intead of another example involving Foo & Bar.
int1 :: Int
int1 = one -- x = 1
-- Or even a Number, which also provides a Semiring
number1 = one :: Number -- y = 1.0

This comment has been minimized.

Copy link
@LiamGoodacre

LiamGoodacre May 10, 2017

Member

What are x and y here?

This comment has been minimized.

Copy link
@MonoidMusician

MonoidMusician May 10, 2017

Author Contributor

Typo, thanks for noticing! Should be int1/number1 as I wanted to provide the concrete value defined for each one.

This comment has been minimized.

Copy link
@chexxor

chexxor May 10, 2017

Collaborator

It seems to be way to explain to a newcomer what one is, here. I think this can be expressed more clearly, perhaps:

int1 = one -- evaluates to 1
number1 = one :: Number -- evaluates to 1.0

A thought on this example: This example requires the reader to understand typeclasses and that Int and Number are Semiring. This might be a unnecessarily large prerequisite as an example of type annotations, but we can find a simpler example later. A imagine a simpler example would be a simple type variable:

x = 1 -- x :: Int
x = 1.0 -- x :: Number
x = (1+_) -- x :: Int -> Int
x = (+) -- x :: Semiring a => a -> a -> a

This comment has been minimized.

Copy link
@MonoidMusician

MonoidMusician May 10, 2017

Author Contributor

Okay, I'll ponder that. I think since it comes after a section on constraints it will be okay. Especially since explicit types are really ideal for specifying constraints. Ideally I would like to come up with better real-world examples to use, but I'm not ready to do that yet. Thanks for the suggestion!

@kRITZCREEK
Copy link
Member

left a comment

What Liam said, otherwise looks great. Thank you!

@@ -23,16 +23,17 @@ Patterns can also be used when introducing functions. For example:
example x y z = x * y + z
```

The following pattern types are supported:
The following forms can be used for matching:

This comment has been minimized.

Copy link
@hdgarrood

hdgarrood May 10, 2017

Member

Can you explain the rationale behind this change?

This comment has been minimized.

Copy link
@chexxor

chexxor May 10, 2017

Collaborator

I like this change, as "form" has fewer connotations than "type", which could confuse newcomers.

This comment has been minimized.

Copy link
@MonoidMusician

MonoidMusician May 10, 2017

Author Contributor

Yes, what he said :). I decided on that wording to draw the distinction we discussed between guards, which are conditional in nature, and what I would call forms of patterns, which match against an argument's shape or value.

This comment has been minimized.

Copy link
@hdgarrood

hdgarrood May 10, 2017

Member

Ok, 👍 for this then

This comment has been minimized.

Copy link
@MonoidMusician

MonoidMusician May 10, 2017

Author Contributor

Okay, thanks for your attention to detail!

@chexxor

This comment has been minimized.

Copy link
Collaborator

commented May 11, 2017

LGTM

@hdgarrood

This comment has been minimized.

Copy link
Member

commented May 11, 2017

Thanks very much!

@hdgarrood hdgarrood merged commit a15f4e6 into purescript:master May 11, 2017

@MonoidMusician

This comment has been minimized.

Copy link
Contributor Author

commented May 11, 2017

Thanks for the feedback!

@paf31

This comment has been minimized.

Copy link
Member

commented May 11, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.