stack ghc error "Invalid Option `--make`
Asked Answered
I

2

10

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 ??

Ireneirenic answered 28/3, 2016 at 0:40 Comment(0)
W
17

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
Warrin answered 28/3, 2016 at 7:8 Comment(0)
S
4

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
Strongbox answered 28/3, 2016 at 0:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.