More feedback on Haskell 98 modules from the Programatica Team

Ketil Malde
10 Aug 2001 09:25:51 +0200

"Simon Peyton-Jones" <> writes:

> Wrong, and I hope that the report is already unambiguous on this point.
> If you say 'import A' then you can refer to "A.f" or "f" but definitely
> not "B.f".  The module qualifier is the name of the module named in the
> import statement (or its "as" alias), not the name of the module where it was
> originally defined.

I tried this with GHC (files below), and it doesn't work the way you
imply.  I.e. a module export is exported with its qualification.  I
guess this is a bug, then?

main.hs: ------------
import A

main = putStr "foo"

A.hs: ----------
module A (a, module B) where

import qualified B

a :: Int
a = 3

B.hs: ----------
module B where

b :: Int
b = 1

transcript: ----------
Prelude> :l main
Compiling B                ( B.hs, interpreted )
Compiling A                ( A.hs, interpreted )
Compiling Main             ( main.hs, interpreted )
Ok, modules loaded: Main, A, B.
(0.18 secs, 3408976 bytes)
Main> b

<no file>:0: Variable not in scope: `b'
(0.00 secs, 0 bytes)
Main> B.b
(0.01 secs, 0 bytes)
Main> A.b

<no file>:0: Variable not in scope: `A.b'
(0.00 secs, 0 bytes)

If I haven't seen further, it is by standing in the footprints of giants