Integrating Acceleration into the Stack Toolchain

I use Haskell Stack for the project, and I want to enable Haste, it compiles the client-side logic. I like the fact that Stack abstracts various build and installation problems among environments, and if it is based on my machine, it will be built on someone else's.

How to integrate Haste into the Stack toolchain? The development of a one-time setup is fine, but I don’t want every time the code has moved to a new system, I need to recreate the entire chain of tools.

+4
source share
1 answer

This should work, but accept it with a piece of salt, as I am having additional problems due to this known error. Make sure your file .cabalhas the correct dependencies, especially the part if impl(haste) ..( see This ). It looks like most of the dependencies for Haste (and since Haste uses GHC 7.10.3 today) work with lts-6.14, so I used this as resolver.

hurry-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 go to the usual setup instructions for Haste , but with the addition of the Cabal command stack:

$ 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 can run all the usual commands, but with a prefix stack exec --. for instance

$ stack exec -- hastec -O2 -fglasgow-exts myprog.hs
+3
source

Source: https://habr.com/ru/post/1652117/


All Articles