Adding type signature changes semantics (was [Haskell-cafe] Lazy in either argument?)

Tim Chevalier catamorphism at
Fri Aug 3 20:14:09 EDT 2007

On 8/3/07, Isaac Dupree <isaacdupree at> wrote:
> The surprise is that an unconstrained type-variable being variable
> rather than instantiated to an arbitrary type, makes any difference
> (since it doesn't, normally, at runtime).

Right... it's surprising because types aren't supposed to "matter" at runtime.

> I would guess the programs
> `Bool` and `a` are the same once optimizations are turned on?  Maybe GHC
> could avoid the creation of type-lambdas that are unused (in some
> sense)... with -Onot... I'm dubious about that.

Right, both programs result in the same runtime behavior if
optimizations are turned on. (Which, of course, is another surprising
thing: the program with the type signature omitted loops if compiled
with -Onot and terminates if compiled with -O.)


Tim Chevalier * chevalier at * Often in error, never in doubt

More information about the Glasgow-haskell-users mailing list