Skip to content

Conversation

@JordanMartinez
Copy link
Contributor

No description provided.

-- | return x; // Nothing
-- | } else {
-- | var x' = x.unwrapJust;
-- | var y = // ...
Copy link
Contributor

Choose a reason for hiding this comment

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

Since x and y are free variables in the first expression, I think they should probably be free variables in the pseudocode too. My main concern, though, would be that .isNothing, .unwrapJust, and wrapIntoJust might not be clear enough: I'd guess the people who are able to work out what these functions/methods mean in this pseudocode are likely to be those who already understand what's going on anyway and don't need any additional explanation. I feel like it might be best to use prose rather than pseudocode here?

Copy link
Contributor

Choose a reason for hiding this comment

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

(I get that my editing for core library docs can be quite demanding, so I'm happy to take a stab at this myself if you'd prefer.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd prefer not using prose. Some examples, like this one, I think are easier to understand when you can see two code examples next to one another.

If you want to submit something, go for it!

I could also break down the bind statements to this before showing the JavaScript version:

case x of
  Nothing -> Nothing
  Just x' -> case y of
    Nothing -> Nothing
    Just y' -> Just (f x' y')

Copy link
Contributor

Choose a reason for hiding this comment

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

That’s a really good point. Inlining everything so that it’s just pattern matching sounds great to me!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'll update it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. Just waiting for CI to pass.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I was imagining that the pattern matching version would be instead of the pseudocode. I have to admit I'm sort of struggling to see the value of the pseudocode example in addition to the pattern matching version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm.... It has value for someone who is familiar with JavaScript or other C-family languages, who is still not yet comfortable with PureScript syntax.
Otherwise, I'm not sure it's needed anymore if they understand pattern matching.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed it in latest commit, so we can get this merged. We can always add it again later if people still have trouble with what's currently written.

@JordanMartinez JordanMartinez merged commit 4437fec into purescript:master Oct 14, 2020
@JordanMartinez JordanMartinez deleted the addDocs branch October 14, 2020 01:20
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