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

Richard A. O'Keefe ok at cs.otago.ac.nz
Fri Oct 9 03:10:24 UTC 2015


On 6/10/2015, at 11:59 am, Doug McIlroy <doug at cs.dartmouth.edu> wrote:
> 
> Another trick is to use plain if rather than #if or #ifdef,
> and let the compiler optimize away the unwanted side of the
> branch.

The University of Edinburgh had their own systems implementation
language, IMP.  Fortran -> Algol 60 -> Atlas Autocode -> IMP.
It was no surprise to find that
    %if <constant condition> %then <true part> %else <false part>
eliminated whichever branch would not be executed.
But it was astonishing to discover that
    %if <constant condition> %then %start
        <declarations T>
    %finish %else %start
        <declarations F>
    %finish
would only process the declarations in the chosen part.
If you want to eliminate the preprocessor, you have got
to handle conditional declarations.

Even IMP did not handle

    %record %format table (
        ...
        %if keeping statistics %then %start
            %integer accesses, hits, misses,
        %endif
        ...)

which is something that a preprocessor can handle.




More information about the Haskell-Cafe mailing list