Skip to content

[Ch3] Indentation docs for where are wrong #397

Description

@keithlayne

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

Activity

  1. milesfrain commented on Nov 21, 2021

    @milesfrain
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions