-allow-extension-for-bottom
Serge D. Mechveliani
mechvel at botik.ru
Mon Oct 11 07:22:22 EDT 2004
Dear Haskell implementors,
Consider the compilation flag -allow-extension-for-bottom
which changes the language meaning so that allows to ignore
the bottom value. For example, the programs
(1) (\ x -> (if p x then foo (g x) else foo (h x)) )
and
(2) (\ x -> foo ((if p x then g x else h x)) )
become equivalent, and many program transformations become
possible.
I suspect that after compiling and running of a program under
-allow-extension-for-bottom the user will discover many helpful
information about the original program.
For example, under -allow-extension-for-bottom it may run 1000
times faster, and then, the user finds out what to change to have
a 1000 times speed-up for the original program for the standard
Haskell.
Thus, in my particular practical example, it is evident to me that
it is better to specify (2). But many similar effects are hard to
find out without compiling under -allow-extension-for-bottom.
Maybe, the compiler could issue the warnings like, say,
"Consider factoring `if' in ... This may improve ... "
?
Copy, please, the answer to mechvel at botik.ru,
-----------------
Serge Mechveliani
mechvel at botik.ru
More information about the Glasgow-haskell-users
mailing list