I am using Haskell Stack for a project and I want to include Haste it compile client side logic. I like the fact that Stack abstracts away the different build and install issues among environments and if it builds on my machine, it will build on someone else's.
How do I integrate Haste into the Stack tool chain? Working out one time setup is fine, but I don't want to have to recreate the whole tool chain every time the code moves to a new system.
This should work, but take that with a grain of salt as I'm having extra issues due to this known bug. Make sure your .cabal
file has the right dependencies, especially the if impl(haste) ..
part (see this). Seems like most of the dependencies for Haste (and since Haste uses GHC 7.10.3 as of today) work with lts-6.14
, so I used that as resolver.
haste-project.cabal
name: haste-project
version: 0.1.0.0
category: Web
build-type: Simple
cabal-version: >=1.10
executable haste-project-exe
hs-source-dirs: app
main-is: Main.hs
build-depends: base >= 4.8 && < 4.9
if impl(haste)
build-depends: haste-lib >= 0.5 && < 0.6
else
build-depends: haste-compiler >= 0.5 && < 0.6
default-language: Haskell2010
stack.yaml
extra-deps:
- HTTP-4000.2.23
- ghc-simple-0.3
- haste-compiler-0.5.4.2
- shellmate-0.2.3
resolver: lts-6.14
Then, from the same directory, you can now proceed with the usual setup instructions for Haste, but with Stack complements of the Cabal commands:
$ stack build
$ stack install haste-compiler # installs haste-boot, haste-cat, haste-pkg, and hastec
$ stack exec haste-boot # setup Haste (where I get the bug I mentioned above)
Then, you should be able to run all the usual commands, but prefixed with stack exec --
. For example
$ stack exec -- hastec -O2 -fglasgow-exts myprog.hs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With