[Haskell-beginners] hidden packages and ambiguous modules

Karl Voelker ktvoelker at gmail.com
Fri Sep 6 18:44:30 CEST 2013


You are hitting this problem because the "base" and "haskell98" packages
really do provide overlapping functionality. The Haskell 98 standard
specifies a few core modules and gives them very simple names, like "Maybe"
and "Time". Modules with these names are provided by haskell98 [1]. By
default, GHC provides the base package instead, which uses hierarchical
names, like "Data.Maybe" and "System.Time". But both packages provide a
module named "Prelude".

I think that in practice, this kind of conflict is quite rare.

The quick fix for your situation is probably to add the flag "-hide-package
base" to your command-line [2]. You could also write a cabal file for this
program - when building with cabal, all packages are hidden by default
unless explicitly listed.

-Karl

1: http://hackage.haskell.org/package/haskell98
2: http://www.haskell.org/ghc/docs/7.6.3/html/users_guide/packages.html


On Fri, Sep 6, 2013 at 2:12 AM, Dimitri Hendriks <diem at xs4all.nl> wrote:

> Hi,
>
> I have ghc version 7.6.3.
> I am trying to compile some code (not mine) with
>
> $ ghc --make Main
>
> and get the message:
>
>    Could not find module `Time'
>    It is a member of the hidden package `haskell98-2.0.0.2'.
>
> Then I tried:
>
> $ ghc -package haskell98-2.0.0.2 --make Main
>
> resulting in
>
>    Ambiguous module name `Prelude':
>      it was found in multiple packages: base haskell98-2.0.0.2
>
> At this point I am stuck. How do I load the right packages without
> introducing ambiguities?
>
> Thanks!
>
> Greetings,
> Dimitri
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130906/919bd08a/attachment.htm>


More information about the Beginners mailing list