[Haskell-cafe] Monad of no `return` Proposal
Doug McIlroy
doug at cs.dartmouth.edu
Mon Oct 5 22:59:21 UTC 2015
> littering the code with #ifdefs
> Bonus points for keeping the #ifdefs centralized
Littering is the right word. "Bonus" is merely less negative points.
It is ironic that the beautiful Haskell should progress by
adopting the worst feature of C. #ifdef is a sticking-plaster
for non-portable code. It is inserted at global level, usually
to effect changes at the bottom of the code hierarchy. (Maybe
in Haskell it should be a monad, in competition with IO for
the outermost layer.)
Plan 9 showed the way out of ifdef, by putting (non-ifdef-ed)
inescapably nonportable code, such as endianity, in compilation
units and #include files in a distinct part of the file system
tree selected by the shell.
Another trick is to use plain if rather than #if or #ifdef,
and let the compiler optimize away the unwanted side of the
branch.
In any event, #ifdef is, as Simon evidently agrees, evidence
More information about the Haskell-Cafe
mailing list