Johan Nordlander nordland@cse.ogi.edu writes:
Christian Sievers wrote: Hello,
there may be a bug with hiding imports.
I tried to load Functional Metapost (http://www.informatik.uni-bonn.de/~ralf/FuncMP.tar.gz) and expected all sorts of problems as it is described to be written in Haskell 1.4, but not this one:
Prelude> :l FMPMain [...] ERROR FMPMain.lhs - Entity "space" imported from module "FMPPP" already defined in module "FMPPicture"
However, the file FMPMain.lhs contains the line
import FMPPicture hiding (text,empty,space)
I cannot see what's goin here: simple tests with hiding worked well. I'm using the Feb 2001 version.
The reason this example doesn't work is because of the module FMPMpsyntax, which imports FMPPicture selectively, and then reexports FMPPicture in the module header. Hugs doesn't implement this correctly, it reexports all identifiers of every module mentioned in its export list.
I've been bitten by this infelicity numerous times too, and started a while ago to modify the sources so as to fix it, but never got around to completing the job. The above report caused me to finally do something about it, so attached is a patch which fixes this problem for Hugs98 (wrt Feb 2001 sources.) Hopefully the patch is in a decent enough shape for it to be included & that it will prove useful to others. BTW, the FuncMP source code highlighted that the version of GHC used to develop FuncMP didn't implement module re-exportation properly - I had to tweak one of the modules (FMPMpsyntax) quite a bit to have it work with Hugs98 (and ghc-4.08) --sigbjorn
participants (1)
-
Sigbjorn Finne