1

I have installed GHCJS and compiled a few "Hello, World" programs. Now I'd like to work with the DOM. Does anyone know if it is possible to install the ghcjs-dom package without webkitgtk? I'm having a lot of difficulty loading the webkitgtk package, and I really just want to work with the DOM at this point.

michaelmesser
  • 3,601
  • 2
  • 19
  • 42
Mark Karavan
  • 2,654
  • 1
  • 18
  • 38
  • 1
    I've been using ghcjs with the ghcjs-dom package and never installed webkitgtk ( at least not intentionally and as far as I know not at all ). How are you going about installing ghcjs/ghcjs-dom ? – Dave Compton Jan 14 '16 at 20:04
  • @Dave I run `cabal install ghcjs-dom`, sometimes with different variants. It keeps getting hung up on something like `Failed to install webkitgtk3-0.14.1.1`. Is there a better way? – Mark Karavan Jan 14 '16 at 20:10
  • 1
    have you installed ghcjs already ? I believe you should do this as a first step. – Dave Compton Jan 14 '16 at 20:12
  • Yes, I have done that successfully – Mark Karavan Jan 14 '16 at 20:17
  • Here's a project I created to try out ghcjs : https://github.com/dc25/ghcjs_demo – Dave Compton Jan 14 '16 at 20:23
  • Cloned and tried to compile...when I ran `ghcjs -o demo Main.hs` I got `Main.hs:1:8: Could not find module ‘GHCJS.DOM’`` and other errors for all the DOM extensions. How did you install the DOM package? – Mark Karavan Jan 14 '16 at 20:32
  • If you clone that project, you should be able to run the following commands... cabal configure --ghcjs; cabal sandbox init; cabal install --only-dependencies --ghcjs; cabal configure --ghcjs; cabal build; ... from within the project to build using ghcjs. The extra configure command was necessary for me because the project seems to forget the ghcjs configuration after the install I just verified that this works on my ubuntu linux machine. The "cabal install" took about 10 minutes You "cabal" will need to be up-to-date enough to support the --ghcjs option. – Dave Compton Jan 14 '16 at 20:40
  • You must already have ghcjs-dom installed. When I run `cabal configure --ghcjs` I get `cabal: At least the following dependencies are missing: ghcjs-dom` – Mark Karavan Jan 14 '16 at 20:43
  • Those cabal commands were supposed to be on different lines. The comment system had other plans though so I added semicolons. – Dave Compton Jan 14 '16 at 20:43
  • 1
    Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/100703/discussion-between-dave-and-mark-karavan). – Dave Compton Jan 14 '16 at 20:43
  • The answer given is more succinct than the steps mentioned in the comments above and discussed in the chat. If you just want to use the ghcjs-dom library with ghcjs, then all you need to do is "cabal install ghcjs-dom --ghcjs". At that point, the ghcjs-dom functionality is available for import and you can compile with ghcjs ( "cabal build" is not required ). – Dave Compton Jan 14 '16 at 22:35

1 Answers1

4

To install ghcjs-dom for use with ghcjs use :

cabal install ghcjs-dom --ghcjs

This requires a version of cabal recent enough to include ghcjs support.

Dave Compton
  • 1,421
  • 1
  • 11
  • 18