When you run stack new ...
, even with the simple
template, you'll notice that several files are created which allow for stack to work. One of these is a Proj_Name.cabal
file, and if you open it, you'll notice that under the executable Proj_Name
section of the file there's a main-is: Main.hs
line.
The default main-is
file will be Main.hs
, but it may be anything. Your imports should go within whatever file you want to act as your main file. So in this case, you can simply put whatever the name of that file you created (which has the System.Process
import) in place of Main.hs
in that line.
Following this, run stack build
, add whatever dependencies it tells you to under the build-depends: base >= 4.7 && < 5
line in Proj_Name.cabal
, which in this case will look like:
build-depends: base >= 4.7 && < 5
, process
run stack build
again (if there are any further issues you might want to consult the stack guide, and now stack ghci
should have all the modules that you imported in that file available to it.
stack build
without process in thebuild-depends
of the .cabal file. My guess would be that the real issue here is that the file you created in/src
was not added to the relevant sections of the .cabal-file (i.e. eitherexposed-modules
orother-modules
). If that is the case, your file is being ignored bystack build
and the other commands. – duplode