Installing threepenny-gui with cabal: what did I do wrong?

488 views Asked by At

I tried installing threepenny-gui, and may have broken things in the process. My questions are (1) how can I fix that, and (2) how should one proceed when cabal issues a warning about possible reinstalls?

threepenny-gui warned me that it might break regex-compat:

jeffreys-mbp:~ jbb$ cabal install threepenny-gui -fbuildExamples

cabal: The following packages are likely to be broken by the reinstalls:
regex-compat-0.95.1
Use --force-reinstalls if you want to install anyway.

I have not yet used regular expressions in haskell, so that seemed worth the risk, and I proceeded:

jeffreys-mbp:~ jbb$ cabal install threepenny-gui -fbuildExamples --force-reinstalls

That launched a process that gave this warning:

Warning: The following packages are likely to be broken by the reinstalls:
regex-compat-0.95.1

but otherwise seemed to work. I then tried running a couple sample programs, without success:

jefferys-mbp:samples jbb$ ./runhaskell Chat.hs
ghc: can't find a package database at ../.cabal-sandbox/*-packages.conf.d
jefferys-mbp:samples jbb$ ./runhaskell MissingDollars.hs 
ghc: can't find a package database at ../.cabal-sandbox/*-packages.conf.d
jefferys-mbp:samples jbb$

I googled that error and found only one page with it, which I did not see how to use.

I thought maybe the problem was that I had broken regex-compat, so I tried reinstalling that:

jefferys-mbp:samples jbb$ cabal install regex-compat
Resolving dependencies...
All the requested packages are already installed:
regex-compat-0.95.1
Use --reinstall if you want to reinstall anyway.
jefferys-mbp:samples jbb$ cabal install regex-compat --reinstall
Resolving dependencies...
In order, the following will be installed:
regex-compat-0.95.1 (reinstall)
Warning: Note that reinstalls are always dangerous. Continuing anyway...
    ## It warned me that its suggestion is dangerous only AFTER I had acted on its suggestion.
Downloading regex-compat-0.95.1...
Configuring regex-compat-0.95.1...
Building regex-compat-0.95.1...
Installed regex-compat-0.95.1
Updating documentation index /Users/jbb/Library/Haskell/share/doc/index.html
jefferys-mbp:samples jbb$ 

I don't know if that reinstalled regex-compat or not, but the samples in threepenny-gui still do not run for me.

I am running OS X Mavericks on an early 2011 MBP. Before threepenny I tried installing wxWidgets and GTK, and both of those seemed to succeed but would not let me run the sample code either. It's making me consider buying another computer and switching to Linux. (Installing Linux on this machine has eluded me too.)

2

There are 2 answers

0
ErikR On

Build it in a sandbox with this recipe:

cabal sandbox init
cabal install --only-dependencies
cabal install

Built executables will reside in .cabal-sandbox/bin

More info on cabal sandboxes may be found here

Your problems have to do with the tangled nest of dependencies any not OSX.

2
Heinrich Apfelmus On

Installing the threepenny-gui package (version 0.5.* at the time of writing) with the -fbuildExamples option will make the examples available as executables. For instance, the chat example can be run by typing

$ threepenny-examples-chat

You can also run the examples from the samples/ folder directly, but this is more of a convenience for the library developer. You don't have to use the runhaskell and ghci scripts; they set up some paths, but they also assume that you have set up a cabal sandbox in the root directory of the source tree and installed the dependencies.

Example code that you've written yourself or copied from somewhere should run perfectly fine.