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

john mangual
  • 6,258
  • 10
  • 47
  • 85

2 Answers2

16

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
Michael Snoyman
  • 30,497
  • 3
  • 43
  • 72
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
epsilonhalbe
  • 14,841
  • 5
  • 38
  • 71