[Haskell-cafe] module is a package module error

Lana Black lanablack at amok.cc
Sat Jan 14 11:12:39 UTC 2017


On 05:09 Sat 14 Jan     , Martin Hilbig wrote:
> meh, i got confused with my different tests and not using cabal clean.
> 
> add this paragraph to your hint-test.cabal:
> 
> library
>   hs-source-dirs:      src
>   default-language:    Haskell2010
>   Exposed-Modules:     Internal
> 
> remove 'import Internal' (or not)
> remove 'loadModules ["Internal"]'
> enjoy.
> 
> i think the error meant to say, this module source file you are trying
> to load is already part of a package, which would be bad if loaded twice.
> 
> and since it's part of your package, you dont need to load it, just
> import it.
> 
> On 14.01.2017 04:55, Martin Hilbig wrote:
> > hi,
> > 
> > i got it to OK by removing your 'loadModules ["Internal"]' line.
> > 
> > i think this works, because you imported Internal in your Main module
> > and set it as Import.
> > 
> > but you might want to check up on loadModules description at [1].
> > 
> > is the Internal module's source file available when you compile your
> > Main module or will it be provided during run-time? in the latter case
> > you will need the loadModules call, but shouldn't import the module.
> > 
> > have fun
> > martin
> > 
> > [1]:https://hackage.haskell.org/package/hint-0.6.0/docs/Language-Haskell-Interpreter.html#v:loadModules
> > 


Unfortunately, this will not work because what I'm actually working on
is a library, and cabal doesn't allow for having multiple libraries in a
single project.

Anyway, I have solved the problem by moving Internal into a separate
package and using stack to build the whole thing. Turned out to be the
easiest solution.


More information about the Haskell-Cafe mailing list