[Haskell-cafe] global variables

Adrian Hey ahey at iee.org
Sun May 20 12:51:34 EDT 2007

Isaac Dupree wrote:
> Maybe some sort of ISOLATE, DON'T_OPTIMIZE (but CAF), or
> USED_AS_GLOBAL_VARIABLE pragma instead of just the insufficient NOINLINE
> would be a good first step... if successful it would remove the
> occasional need for -fno-cse for a whole module in GHC, at least.

I have a hard time trying to understand why anyone would prefer
this to the simple and clear <- syntax that's been proposed. As
for the ACIO monad itself, this is utterly trivial and requires
no language change. It's just a library.

Maybe the first pragma you propose might have other uses to control
optimisations, so I'm not totally anti this. But generally I
dislike pragmas (I always find myself wondering what's wrong
with the language design that makes the pragma necessary).

So pragmas that influence optimisation are something I can
live with. But using pragmas to influence *semantics* really
is an evil practice IMO and is something that should be
discouraged, not made an unavoidable necessity.

But yes, if this problem isn't going to be properly addressed
then at the very least the -fno-cse flag or something similar
needs standardising (NOINLINE already is I think). Or we port
all existing unsafePerfomIO hacked code to use Johm Meachams
variant of the hack (uses types to ensure the compiler doesn't
see common sub-expressions).

Adrian Hey

More information about the Haskell-prime mailing list