Suppose I wish to write the following program:

> main :: IO ()
> main = print True

using a qualified import of the Prelude:

> import qualified Prelude
> 
> main :: Prelude.IO Prelude.()
> main = Prelude.print Prelude.True

The third line is syntactically incorrect as `()' is a non-standard
constructor and therefore not subject to the qualified import rules.

Therefore, we try the following:

> import qualified Prelude
> 
> main :: Prelude.IO ()
> main = Prelude.print Prelude.True

which works on one of my compilers (nhc) but not on the other (hbc)---
I can't try ghc yet as I've still not managed to compile it (for
Haskell 1.3 or 1.4) for IRIX5.3 :-(.

Should this latter version be accepted by all compilers or not?  The
Report has a section on importing the Prelude but I haven't been able
to apply it to this problem.

Cheers,

Graeme.

PS. I've come across the above as a real problem (for a more
substantial program than the above!) when generating a module that may
export an entity of a name that clashes with the Prelude (and hence
all Prelude names must be qualified as the generation of the module is
automated and the entities that are exported by the module are
supplied by the user, and indeed I wish to allow names that clash with
the Prelude).



Reply via email to