Reputation: 497
I'm trying to write a small web application fully in Haskell. I have 3 logical packages:
servant
reflex
, reflex-dom
and servant-reflex
That last package is giving me trouble. I don't know how to structure the project so the other 2 packages can use it. I see 2 options at the moment:
extra-deps
git link. The problem with this approach is it means I have to push any change to the shared package to GitHub before I can test it out with the other packages. Also I'd have to build everything separately.packages:
option. However, the client needs to be compiled with GHCJS, not GHC, and I don't see an option in the documentation to override the compiler for 1 specific package.Is there a way to make option 2 work? Or is there a better way to do this?
Upvotes: 0
Views: 69
Reputation: 111
The recommended approach is to have two stack project files (e.g. stack-frontend.yaml
using GHCJS and stack-backend.yaml
using GHC), and then use the --stack-yaml
argument to switch between them (e.g. use stack --stack-yaml=stack-frontend.yaml build
to build the frontend, and stack --stack-yaml=stack-backend.yaml build
to build the backend). Both stack-*.yaml
files can include the shared servant API.
Upvotes: 1