-
Notifications
You must be signed in to change notification settings - Fork 196
Description
Chapter 3 includes the following as an example of how ($)
can make things easier to read by reducing the number of parentheses:
For example, the following nested function application, which finds the street in the address of an employee's boss:
street (address (boss employee))becomes (arguably) easier to read when expressed using $:
street $ address $ boss employee
However, these street
, address
, and boss
accessor functions are not defined. I think this would be valid Haskell when using record syntax, but, based on my quick experiments in PSCi 0.13.8, it seems like PureScript doesn't automatically create these accessor functions.
I'm new to PureScript, so I could be missing something here.
Suggestion is to rewrite this a bit, maybe by introducing record accessor functions using _.
per issue #281, and then rewriting the above as:
For example, the following nested function application, which finds the street in the address of an employee's boss:
_.street (_.address (_.boss employee))becomes (arguably) easier to read when expressed using $:
_.street $ _.address $ _.boss employee
I can take a crack at this, unless I'm misunderstanding how PureScript works.