Text.ParserCombinators.Parsec requires -package text.
George Russell
ger at informatik.uni-bremen.de
Tue Sep 7 07:24:17 EDT 2004
Simon Peyton-Jones wrote:
> It's documented behaviour.
>
> * import Text.ParserCombinators.Parsec will work without any -package
> flags, if any installed package has a module
> Text.ParserCombinators.Parsec. It's very tiresome adding -package flags
> all the time.
>
> * The link step needs -package flags, because it only gets .o files, and
> we didn't want it to start hunting through .hi files (though that would
> be possible)
>
> * ghc Main.hs is by definition equivalent to ghc -c Main.hs; ghc Main.o,
> and the latter step needs the package flag. If you say ghc --make
> Main.hs you'll get what you want.
Even though it is documented behaviour I think it is wrong.
It looks as if we now have the rather complicated situation that
"import Text.ParserCombinators.Parsec" will work during compilation
without loading the package parsec *unless* one of the other modules
being compile imports this module and uses Template Haskell. It will
work during linking *if* you used --make, but otherwise you get some
very user-unfriendly messages about undefined symbols.
GHC's package system is good because it makes libraries
available in a uniform way. The above complex rules just make things
more complicated. People who have trouble typing "--package parsec"
should learn to use Make. The solution someone else proposed of
stashing extra information in the object file to help the linker just
seems to me a recipe for more complexity, and in any case wouldn't
work when packages only contain non-GHC object files. (Like some of
mine.)
More information about the Glasgow-haskell-bugs
mailing list