[Haskell-cafe] Monad of no `return` Proposal

Kosyrev Serge _deepfire at feelingofgreen.ru
Fri Oct 9 09:00:09 UTC 2015

"Richard A. O'Keefe" <ok at cs.otago.ac.nz> writes:
> On 6/10/2015, at 10:16 pm, Kosyrev Serge <_deepfire at feelingofgreen.ru> wrote:
>> As an example of the opposite end, consider Common Lisp, which:
>>  1. reifies READ as the third processing phase (macroexpansion[1] and actual
>>     compilation being the other two)
>>  2. operates at expression granularity
>>  3. makes the full power of the language available to support the
>>     decision process of what subexpressions are available in which
>>     contexts
> Except that the syntax for conditional reading in Common Lisp,
>     #+ <feature> <datum>
>     #- <feature> <datum>
> (a) is utterly different from conditional evaluation,
>     like (if <expr> <expr> <expr>).
> (b) does NOT make the full power of the language available.
>     The feature test is a Boolean combination, using and, or, not
>     of atoms, where the value of an atom is true iff it is a
>     member of *features* (the asterisks are part of the name).

There are several issues mixed up here:

 1. Desirability of expression-level granularity of pre-processing.

 2. The desired palette of options for this pre-processing (if desired),
    that varies in expressive power.

 3. The difference between #+/#- and #. (aka *READ-EVAL*,
    http://clhs.lisp.se/Body/v_rd_eva.htm) in Common Lisp.

My original message was about point #1, but point #2 deserves a similar
kind of attention.

The point #3 is purely didactic -- the READ-time processing is layered
in Common Lisp into:

  1. the basic layer, covering 95% of cases, which uses the following primitives,
     to decide if an expression suffix needs to be included:

     - *FEATURES*, a variable containing a list of features
     - ability to test for presence of a certain symbol within *FEATURES*
     - ability to combine atomic tests using AND, OR, NOT 

     It is, indeed, what is covered in the example that I have provided.

  2. the full language layer, available through #. -- whatever is returned
     by the expression following #. is inserted as program text.

This layered approach has some merit:

  - It provides a kind of frugal brevity, that is sufficient in 95% of cases

  - Whenever the soft option fails, it unleashes the whole language to
    express basically anything during that pre-processing phase.

Except, in the latter case it /probably/ doesn't count as pre-processing anymore,
since the inserted text is no longer external to the pre-processor directives.

с уважениeм / respectfully,
Косырев Серёга
“And those who were seen dancing were thought to be insane
 by those who could not hear the music.”
 – Friedrich Wilhelm Nietzsche

More information about the Haskell-Cafe mailing list