MercuryTechnologies / ghciwatch

Load a GHCi session for a Haskell project and reload it when source files change
https://mercurytechnologies.github.io/ghciwatch/
MIT License
104 stars 9 forks source link

multiple components with cabal-install 3.12.1.0 #316

Open mwotton opened 4 weeks ago

mwotton commented 4 weeks ago

What happened?

carrying on from https://github.com/MercuryTechnologies/ghciwatch/issues/308 - cabal-install 3.12.1.0 is out now, and the multiple component repl seems to work. unfortunately, ghciwatch crashes:

ghciwatch --command "cabal repl --enable-multi-repl mylib mylib:mylib-test" --watch src --watch test  --test-ghci main

...ghci loading elided...

Ok, 13 modules loaded.
Error:   × Tasks failed:
  │ • run_ghci: Failed to parse `:show targets` output

running cabal repl --enable-multi-repl mylib mylib:mylib-test and running :show targets, it shows my library modules and my test modules, but also 'test/Main.hs' in the list, so perhaps not surprising ghciwatch crashes if it's expecting a module name.

What did you expect to happen?

expected ghciwatch to load and run my tests.

Steps to reproduce the issue

i think you can replicate this with any library with a test component.

The version of ghciwatch with the bug

ghciwatch 1.0.1

mwotton commented 4 weeks ago

playing around with it a bit, even if i manually filter test/Main.hs, it still chokes on my test module, which makes sense given that the test source folder isn't in the search_paths at that point.

mwotton commented 4 weeks ago

(if i'm totally off-base here and there's a good workaround for having ghciwatch reload both tests and code that doesn't require multi-components, please let me know!)

mwotton commented 3 weeks ago

ah, so the current hack in https://github.com/MercuryTechnologies/ghciwatch/tree/main/tests/data/simple is to just have a single component that pulls in everything? ok, that makes sense.

9999years commented 3 weeks ago

This shouldn't crash, I'd like to support multiple components.