I have a standalone Haskell file I am editing in Visual Studio Code. I’m learning Haskell and simply using ghci
to run my code in the integrated terminal.
However, the VS Code editor is complaining that it Could not find module...
for one of my import
statements (e.g., import System.Random
).
Question: If I don’t want to create a full project with a dependencies list, what can I do?
This seems to work, says the newbie:
- In a terminal, run
cabal install --lib random
(for example) - In VS Code’s Command Palette, run
Developer: Reload Window
The cabal install --help
says:
If TARGET is a library and --lib (provisional) is used,
it will be added to the global environment.