hastec import Network.Pcap fails

16 views
Skip to first unread message

Dave Compton

unread,
Apr 10, 2015, 4:43:08 PM4/10/15
to haste-c...@googlegroups.com
I'm working on a client/server Haste.App utility.  In the server code I would like to use the pcap library.

The haste compiler is having trouble with :

import Network.Pcap

-----------------------------------------------------------------------
ghc --make showconn.hs
[1 of 1] Compiling Main             ( showconn.hs, showconn.o )
Linking showconn ...
hastec showconn.hs

showconn.hs:17:8:
    Could not find module `Network.Pcap'
    Use -v to see a list of the files searched for.
make: *** [showconn.js] Error 1
-----------------------------------------------------------------------

I've tried:

  -- reinstalling pcap : cabal install pcap
  -- exposing pcap     : haste-pkg expose pcap
  -- rebooting haste   : mv ~/.haste ~/.haste.old ;  haste-boot --local

I'm working around this by using "#ifndef __HASTE__" to hide the problem code from hastec.  With these ifdefs in place, the code compiles and works but it does not seem like a clean fix.

Is there a "right way" ( or possibly just a better way to fix this) ?

I'm using version 4.4.3 of the haste compiler which I got from github by cloning from github and then checking out tag 0.4.4.3 .

I'm using ghc 7.6.3 and cabal 1.20.0.3

My build machine is running Ubuntu 14.04

Thank you.

Dave Compton

unread,
Apr 11, 2015, 9:49:21 PM4/11/15
to haste-c...@googlegroups.com
The command to use is : haste-inst install pcap

Anton Ekblad

unread,
Apr 13, 2015, 7:42:20 AM4/13/15
to haste-c...@googlegroups.com
Haste uses a separate package database from GHC, in part since some core packages are implemented a bit differently to account for the difference in execution environment and in part to avoid cluttering up your vanilla GHC install with web-specific packages. This is, however, an annoyance when it comes to Haste.App, since you need to install any packages used for both vanilla GHC and Haste, using `cabal` and `haste-inst` respectively.

/Anton
Reply all
Reply to author
Forward
0 new messages