I'd like to use hsc2hs via Stack and HPack. The problem is, since HPack doesn't allow me to list the .hsc
file as a source file, only .hs
, changes to the .hsc
file don't trigger a rebuild in stack build
.
My package.yaml
file is as follows:
name: bounce-bench
version: 0.1.0
category: acme
dependencies:
- base
source-dirs:
- src
executables:
sim-ffi:
source-dirs: sim
main: sim-ffi.hs
build-tools: hsc2hs
c-sources:
- csim/Bounce.h
- csim/Bounce.c
include-dirs: csim
With the above file, the initial stack build
succeeds (incl. building sim-ffi.hs
from sim-ffi.hsc
), however, subsequent stack build
invocations don't do anything if sim-ffi.hsc
is changed.
If I try to change the main
key's value from sim-ffi.hs
to sim-ffi.hsc
, I am explicitly told off:
Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5: The 'main-is' field must specify a
'.hs' or '.lhs' file (even if it is generated by a preprocessor), or it may
specify a C/C++/obj-C source file.