atom-haskell / ide-haskell-repl

GHCi REPL in Atom
https://atom.io/packages/ide-haskell-repl
MIT License
26 stars 8 forks source link

Question: how to load a test file with other mod dependencies in ide-haskell-repl? #55

Closed theGhostJW closed 6 years ago

theGhostJW commented 6 years ago

Hi, I have just reopened a project I worked on many months (and many package updates) ago and I no longer seem to be able to load a one of my test files in ide-haskell-repl.

Here is the section of the cabal file:


test-suite test-Parser
 type: exitcode-stdio-1.0
 main-is:
   ParserTest.hs
 build-depends:
   Parser,
   QuickCheck -any,
   quickcheck-text -any,
   base -any,
   megaparsec -any,
   raw-strings-qq -any,
   tasty -any,
   tasty-hunit -any,
   tasty-quickcheck -any,
   tasty-th -any,
   text -any,
   mtl -any,
   containers -any,
   either
 default-language: Haskell2010
 hs-source-dirs: test
 other-modules:
   ParserTestHelpers
   TestData
 ghc-options: -ferror-spans -main-is ParserTest

Now if I have ParserTest.hs open in Atom and invoke I get the following:

Parser-0.0.1: configure (lib + exe)
Configuring Parser-0.0.1...
Parser-0.0.1: initial-build-steps (lib + exe)
Configuring GHCi with the following packages: Parser
Using main module: 1. Package `Parser' component exe:QuickStepMergeEngine with main-is file: C:\Automation\QuickStep\Parser\mergeEngine\MergeEngine.hs
Some flags have not been recognized: prompt-cont, 
C:\Automation\QuickStep\Parser\test\ParserTest.hs:39:1-34: error:
    Failed to load interface for ‘ParserTestHelpers’
    Use -v to see a list of the files searched for.
C:\Automation\QuickStep\Parser\test\ParserTest.hs:48:1-25: error:
    Failed to load interface for ‘TestData’
    Use -v to see a list of the files searched for.

I can load the file in Stack as follows:

PS C:\Automation\QuickStep\Parser> stack ghci Parser:test:test-Parser
Configuring GHCi with the following packages: Parser
Using main module: 1. Package `Parser' component test:test-Parser with main-is file: C:\Automation\QuickStep\Parser\test\ParserTest.hs
GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help
[1 of 3] Compiling TestData         ( C:\Automation\QuickStep\Parser\test\TestData.hs, interpreted )
[2 of 3] Compiling Paths_Parser     ( C:\Automation\QuickStep\Parser\.stack-work\dist\ca59d0ab\build\autogen\Paths_Parser.hs, interpreted )
[3 of 3] Compiling ParserTestHelpers ( C:\Automation\QuickStep\Parser\test\ParserTestHelpers.hs, interpreted )
Ok, modules loaded: ParserTestHelpers, Paths_Parser, TestData.
[4 of 4] Compiling ParserTest       ( C:\Automation\QuickStep\Parser\test\ParserTest.hs, interpreted )
Ok, modules loaded: ParserTest, ParserTestHelpers, Paths_Parser, TestData.
Loaded GHCi configuration from C:\Users\thegh\AppData\Local\Temp\ghci512\ghci-script
*ParserTest ParserTestHelpers TestData>

I have tried playing around with exta Args in settings but not having any luck.

How can I load this file in ide-haskell-repl?

Thanks John

P.S. Current Package options are as follows:


  "ide-haskell-repl":
    autoReloadRepeat: true
    checkOnSave: true
    defaultRepl: "stack"
    ghciWrapperPath: "C:\\stack\\ghci-wrapper.exe"
    showTypes: true
    stackPath: "C:\\stack\\bin\\stack.exe"

lierdakil commented 6 years ago

I ran some tests, and I might have a vague idea why that happens. Long story short, internal stack changes, probably. Anyway, I released v0.7.5, could you see if it works for you?

theGhostJW commented 6 years ago

Parser.zip

Hi Thanks for looking into this. Still having the same issue with v0.7.5 I am afraid.

Have attached the project. Issue is when loading ParserTest.hs in REPL. Hope this helps. Thanks John

lierdakil commented 6 years ago

Huh. Can't reproduce on Linux. I'll have to find a Windows box. That might take a bit.

lierdakil commented 6 years ago

In the meantime, what's your stack version? (stack --version output)

theGhostJW commented 6 years ago

PS C:\Automation\QuickStep\Parser> stack --version Version 1.5.1, Git revision 600c1f01435a10d127938709556c1682ecfd694e x86_64 hpack-0.17.1


OS: Windows 10 Version 1709 OS Build 16299.64

lierdakil commented 6 years ago

I believe v0.7.6 should work.

theGhostJW commented 6 years ago

CORRECT !!! v0.7.6 works like a charm !! Thanks Heaps