Untitled conversation
- User
[Running] runghc "c:\Users\alous\some-fresh-foldername\src\task25.hs"
C:\\Users\alous\some-fresh-foldername\src\task25.hs:2:1: error: Could not find module
Test.HUnit' Use -v (or:set -v` in ghci) to see a list of the files searched for. | 2 | import Test.HUnit ( (@?=), (~:), runTestTT )| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Done] exited with code=1 in 3.778 seconds
- Assistant
The error message indicates that the Haskell module
Test.HUnitcouldn't be found. This typically means that the HUnit library isn't installed in your GHC environment. Here's how you can resolve this issue:-
Install HUnit: You need to install the HUnit library using the Cabal package manager or the Stack tool.
-
- User
How do i know if im using cabal or stack. I have both a stack.yaml file and a .cabal file.
- Assistant
- User
Does runghc use stack or cabal
- Assistant
runghcis a utility provided by the Glasgow Haskell Compiler (GHC) that runs a Haskell program directly from the source file without needing to compile it first. By default,runghcdoes not inherently use either Stack or Cabal. It simply interprets and runs the Haskell code using the GHC compiler on your PATH, which might not have access to project-specific dependencies managed by Stack or Cabal.However, you can control the environment in which
runghcoperates to ensure it has access to dependencies managed by either build tool.Using with Stack
- User
When I run the code with stack ghci it works, but when i use the run button from VSC, which uses runghc, it says module not found.
- Assistant