LoadAllTargets not loading dependencies

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

LoadAllTargets not loading dependencies

fommil
Hello all,

I've been following along with Stephen Diehl's blog series on the ghc
api and I am using `load LoadAllTargets` on a .hs file (let's call it
Wibble.hs) and then typechecking.

All seems well until I add a second module (let's call it Wobble.hs) in
the same package and import it from Wibble.

I can see that the load has correctly calculated the dependency graph
and includes Wobble in the dependencies of Wibble. But if I try to
typecheck Wibble, then I get an error:

    Could not find module ‘Wobble’
    Use -v to see a list of the files searched for.
  |
4 | import           Wobble
  | ^^^^^^^^^^^^^^^^^^^^^^^

I have separately compiled the package, and can see its packagedb is
listed in the .ghc.env file. What else do I need to do so that Wibble
can see Wobble?

--
Best regards,
Sam


_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

signature.asc (199 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: LoadAllTargets not loading dependencies

Artem Pelenitsyn
Hello Sam,

It'd be easier to help if you posted the complete example somewhere (e.g. Github).

--
Best, Artem

On Wed, 7 Aug 2019 at 15:39, Sam Halliday <[hidden email]> wrote:
Hello all,

I've been following along with Stephen Diehl's blog series on the ghc
api and I am using `load LoadAllTargets` on a .hs file (let's call it
Wibble.hs) and then typechecking.

All seems well until I add a second module (let's call it Wobble.hs) in
the same package and import it from Wibble.

I can see that the load has correctly calculated the dependency graph
and includes Wobble in the dependencies of Wibble. But if I try to
typecheck Wibble, then I get an error:

    Could not find module ‘Wobble’
    Use -v to see a list of the files searched for.
  |
4 | import           Wobble
  | ^^^^^^^^^^^^^^^^^^^^^^^

I have separately compiled the package, and can see its packagedb is
listed in the .ghc.env file. What else do I need to do so that Wibble
can see Wobble?

--
Best regards,
Sam
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: LoadAllTargets not loading dependencies

fommil
Hi Artem,

You're quite right, because when I tried to minimise this I discovered
that it is actually a cabal env file bug! It seems that cabal v2-exec
produces different env files depending on if -w is used or not, and the
one I was using is the broken one.

Artem Pelenitsyn <[hidden email]> writes:

> Hello Sam,
>
> It'd be easier to help if you posted the complete example somewhere (e.g.
> Github).
>
> --
> Best, Artem
>
> On Wed, 7 Aug 2019 at 15:39, Sam Halliday <[hidden email]> wrote:
>
>> Hello all,
>>
>> I've been following along with Stephen Diehl's blog series on the ghc
>> api and I am using `load LoadAllTargets` on a .hs file (let's call it
>> Wibble.hs) and then typechecking.
>>
>> All seems well until I add a second module (let's call it Wobble.hs) in
>> the same package and import it from Wibble.
>>
>> I can see that the load has correctly calculated the dependency graph
>> and includes Wobble in the dependencies of Wibble. But if I try to
>> typecheck Wibble, then I get an error:
>>
>>     Could not find module ‘Wobble’
>>     Use -v to see a list of the files searched for.
>>   |
>> 4 | import           Wobble
>>   | ^^^^^^^^^^^^^^^^^^^^^^^
>>
>> I have separately compiled the package, and can see its packagedb is
>> listed in the .ghc.env file. What else do I need to do so that Wibble
>> can see Wobble?
>>
>> --
>> Best regards,
>> Sam
>> _______________________________________________
>> ghc-devs mailing list
>> [hidden email]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>>
--
Best regards,
Sam


_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

signature.asc (199 bytes) Download Attachment