Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stack ghc error "Invalid Option `--make`

I am learning Hakyll a library in Haskell. I need to run

ghc --make site.hs

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

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

How am I supposed to compile my site.hs ??

like image 973
john mangual Avatar asked Mar 28 '16 00:03

john mangual


2 Answers

Stack is interpreting your --make as being an option to Stack, not to the GHC subcommand. In order to tell Stack "I'm done giving you options, the rest is for the subcommand," you can use a --, e.g.:

stack ghc -- --make site.hs
like image 117
Michael Snoyman Avatar answered Oct 17 '22 16:10

Michael Snoyman


the chain of command you are looking for is

> 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 running the file without compilation you can use

> stack runghc app/site.hs
like image 36
epsilonhalbe Avatar answered Oct 17 '22 16:10

epsilonhalbe