graninas / Hydra

Hydra is a full-fledged framework for building web services, multithreaded and concurrent applications with SQL and KV DB support.
BSD 3-Clause "New" or "Revised" License
184 stars 13 forks source link

disambiguate-perf2 disambiguate-perf2 #30

Closed yaitskov closed 4 years ago

yaitskov commented 4 years ago

Fix module name collision in ghci.

This helps but doesn't solve ghci problem completely. Since last stack reorganization ghci complains on duplicated Main modules too. I cannot rename them. I tried to find a workaround with --main-is astro:exe:astro, but ghci needs -threaded option. I've not found how to pass it through stack ghci. GHCi helps a lot during getting familiar with codebase.

stack ghci --main-is MeteorCounter:exe:MeteorCounter
Using main module: 1. Package `MeteorCounter' component MeteorCounter:exe:MeteorCounter with main-is file: /home/dan/demo/haskell/gsoc/Hydra/app/MeteorCounter/src/Main.hs
The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
Configuring GHCi with the following packages: Hydra, MeteorCounter, PerfTestApp, PerfTestApp2, astro, labyrinth

* * * * * * * *

Error: Multiple files use the same module name:
       * Main found at the following paths
         * /home/dan/demo/haskell/gsoc/Hydra/app/MeteorCounter/src/Main.hs (MeteorCounter:lib)
         * /home/dan/demo/haskell/gsoc/Hydra/app/PerfTestApp/src/Main.hs (PerfTestApp:lib)
         * /home/dan/demo/haskell/gsoc/Hydra/app/PerfTestApp2/src/Main.hs (PerfTestApp2:lib)
         * /home/dan/demo/haskell/gsoc/Hydra/app/astro/src/Main.hs (astro:lib)
         * /home/dan/demo/haskell/gsoc/Hydra/app/labyrinth/src/Main.hs (labyrinth:lib)
* * * * * * * *

Not attempting to start ghci due to these duplicate modules.
Use --no-load to try to start it anyway, without loading any modules (but these are still likely to cause errors)
yaitskov commented 4 years ago

I've solved the issue with main module disambiguation:

stack ghci PerfTestApp2:exe:PerfTestApp2

--main-is is not need

Though it worth mentioning that ghci loads all apps by default even if it is launched in a particular app folder (/home/dan/demo/haskell/gsoc/Hydra/app/astro).

graninas commented 4 years ago

Hi @yaitskov , thanks for pointing this out.

I'm now researching the problem. There is a lot of hidden pitfalls here. Once I get an understanding of this, I'll update the README file.

JFYI: I mostly don't use ghci but I understand the need of this. JFYI2: I made this huge restructuring as planned one, because I'm moving this whole project into new rails suitable for production. A lot of restructuring and renaming is still ahead. I'm now planning to have several subprojects for all the engines.