logo       

RE: Text.ParserCombinators.Parsec requires -package text.: msg#00032

lang.haskell.glasgow.bugs

Subject: RE: Text.ParserCombinators.Parsec requires -package text.

On 07 September 2004 12:24, George Russell wrote:

> 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.

I don't like it either, but I don't like it less than the other
solutions. I don't like the other solutions quite a lot.

Could you elaborate on the template haskell problem you mentioned? I
don't think template haskell is affected by this (i.e. it's still just
batch linking that requires the -package options, template haskell
should still work just fine without them).

> 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.)

So you're proposing that -package options should *always* be required?
Even for --make? I think you might encounter some resistance to that...

Cheers,
Simon


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise