Installing Haste with GHC 8.0.x

97 views
Skip to first unread message

Jeff chen

unread,
Dec 6, 2017, 9:54:04 AM12/6/17
to 2017 Functional Programming TDA452 / DIT 142
Hello all, 

If you want to have graphical interface using Haste 
but you have installed GHC 8.0.x (which is not supported by haste) as your system-wise Haskell compiler, here is a way to have a clean working directory: 

1. make sure you have stack installed 
(check by calling `stack --version` in your terminal)

stack --version

2. create a stack project repository by `stack new YourProjectName`
3. cd to the created repository 
4. edit your `stack.yaml` by adding the following:
   A. in your _resolver_ section

resolver: lts-6.14

   B. in your _extra-deps_ section: 
        add in the following dependencies 

extra-deps:
- HTTP-4000.2.23
- ghc-simple-0.3
- haste-compiler-0.5.4.2
- shellmate-0.2.3


After modifying the `stack.yaml` file, you should be able to run `stack setup` in the project repository and stack will install the correct ghc version suitable for haste LOCALLY inside this project repository. 

To test if the dependencies are correctly installed, do the following: 
1. include a module which imports Haste (a good start would be the `Pages.hs` from course page) 
put this module inside your src folder.
2. update your YourProjectName.cabal, it should be located at the top level of your project directory. You should update build-depends section by including haste, for example: 

library
  hs-source-dirs:      src
  exposed-modules:     Lib
                       , Pages
  build-depends:       base >= 4.7 && < 5
                       , haste-compiler >= 0.5
  default-language:    Haskell2010


3. run `stack build` in your project directory, you should be able to compile the project correctly. 


If you have more question regarding stack, take a look at stack website Home - The Haskell Tool Stack

Good luck with your projects :) 

- jef

Eros Fabrici

unread,
Dec 11, 2017, 9:20:03 AM12/11/17
to 2017 Functional Programming TDA452 / DIT 142

Hello, I did all the steps, but I am getting this error after running stack build at the end:

[1 of 2] Compiling Main             ( C:\sr\setup-exe-src\setup-Z6RU0evB.hs, C:\sr\setup-exe-src\setup-Z6RU0evB.o )
[2 of 2] Compiling StackSetupShim   ( C:\sr\setup-exe-src\setup-shim-Z6RU0evB.hs, C:\sr\setup-exe-src\setup-shim-Z6RU0evB.o )
Linking C:\sr\setup-exe-cache\x86_64-windows\tmp-Cabal-simple_Z6RU0evB_1.22.5.0_ghc-7.10.3.exe ...
GraphCalculator-0.1.0.0: configure (lib + exe)
Configuring GraphCalculator-0.1.0.0...
GraphCalculator-0.1.0.0: build (lib + exe)
Preprocessing library GraphCalculator-0.1.0.0...

C:\Users\erosf\GraphCalculator\src\Pages.hs:7:8:
    Could not find module `Haste'
    Use -v to see a list of the files searched for.

C:\Users\erosf\GraphCalculator\src\Pages.hs:8:8:
    Could not find module `Haste.Prim'
    Use -v to see a list of the files searched for.

C:\Users\erosf\GraphCalculator\src\Pages.hs:9:8:
    Could not find module `Haste.Foreign'
    Use -v to see a list of the files searched for.

C:\Users\erosf\GraphCalculator\src\Pages.hs:10:8:
    Could not find module `Haste.DOM'
    Use -v to see a list of the files searched for.

--  While building package GraphCalculator-0.1.0.0 using:
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_1.22.5.0_ghc-7.10.3.exe --builddir=.stack-work\dist\2672c1f3 build lib:GraphCalculator exe:GraphCalculator-exe --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1

Jeff chen

unread,
Dec 11, 2017, 11:56:07 AM12/11/17
to 2017 Functional Programming TDA452 / DIT 142
Hello All, 

As we are looking into this issue now, it is advisable to change from using Haste to threepenny-gui (http://hackage.haskell.org/package/threepenny-gui)
(Detailed guide can be found from the Lab 4 page) 

good luck with your projects
Jeff
Reply all
Reply to author
Forward
0 new messages