Ghc stack error 'Invalid parameter` --make`

I am studying the Hakyll library in Haskell. I need to run

ghc --make site.hs 

However, I installed ghc with Stack , so I can no longer run ghc , but instead stack ghc

 $ stack ghc --make site.hs Invalid option `--make' 

How do I compile my site.hs ??

+5
source share
2 answers

Stack interprets your --make as an option for Stack, not for the GHC subcommand. To tell Stack, "I am finished giving you options, the rest is for the subcommand," you can use -- for example:

 stack ghc -- --make site.hs 
+10
source

the command chain you are looking for

 > stack build > stack exec -- mysite 

Assuming your cabal file looks like

 ... executable mysite main-is: site.hs hs-source-dirs: app ... 

if you want to just try to run the file without compilation, you can use

 > stack runghc app/site.hs 
+3
source

Source: https://habr.com/ru/post/1245882/


All Articles