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

[Ch3] Indentation docs for where are wrong #397

Closed
keithlayne opened this issue Nov 13, 2021 · 1 comment · Fixed by #448
Closed

[Ch3] Indentation docs for where are wrong #397

keithlayne opened this issue Nov 13, 2021 · 1 comment · Fixed by #448

Comments

@keithlayne
Copy link

In https://book.purescript.org/chapter3.html#notes-on-indentation it says:

Certain PureScript keywords (such as where, of and let) introduce a new block of code, in which declarations must be further-indented:

and then there's this block:

example x y z = foo + bar
  where
    foo = x * y
    bar = y * z

Unless I'm reading this wrong, it's saying that bindings under where must be further indented, which isn't true.

See that chapter's AddressBook.purs, which seems to violate that rule: https://github.com/purescript-contrib/purescript-book/blob/master/exercises/chapter3/src/Data/AddressBook.purs#L62-L69

@milesfrain
Copy link
Member

Wow. Great catch and attention to detail here!

This note about required where indentation was written by the original language creator (see the same section in the first edition of the book). But the official reference indicates that where blocks don't require indentation.

This is why I wish the book didn't even bother with some of these details, and would instead point to a centralized reference and just focus on exercises. More ranting about that proposal can be found in #340.

Feel free to rewrite part of that section to make it more accurate. Perhaps just replace the where example with a let example.

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

Successfully merging a pull request may close this issue.

2 participants