Having problems installing a Haskell package called Tidal, using cabal on Ubuntu 18:04.
https://tidalcycles.org/index.php/Userbase
I'm not a Haskell expert and have borked this stuff a couple of times before, so am trying as fresh an install as possible, using this -
https://www.haskell.org/ghcup/
I clean out as much of the Haskell- related stuff as I can -
justin@justin-XPS-13-9360:~$ rm -rf ~/.cabal/
justin@justin-XPS-13-9360:~$ rm -rf ~/.ghc
justin@justin-XPS-13-9360:~$ rm -rf ~/.ghcup
And also any Ubuntu legacy Haskell -
justin@justin-XPS-13-9360:~$ sudo apt-get remove ghc
So that -
justin@justin-XPS-13-9360:~$ ghci
bash: /home/justin/.ghcup/bin/ghci: No such file or directory
OK let's go -
curl https://get-ghcup.haskell.org -sSf | sh
Which gives me -
{...}
Done installing, run "ghci-8.6.5" or set up your current GHC via: ghcup set 8.6.5
Setting GHC to 8.6.5
Done
Setting GHC to 8.6.5
Done
{...}
Successfully installed cabal-install into
/home/justin/.ghcup/bin
Detected "/home/justin/.bashrc" on your system...
If you want ghcup to automatically fix your "/home/justin/.bashrc" to include the required PATH variable
answer with YES, otherwise with NO and press ENTER.
YES
OK! /home/justin/.bashrc has been modified. Restart your terminal for the changes to take effect,
or type "source /home/justin/.ghcup/env" to apply them in your current terminal session.
Let's set the PATH and test -
justin@justin-XPS-13-9360:~$ source /home/justin/.ghcup/env
justin@justin-XPS-13-9360:~$ ghci
GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help
Prelude>
So far so good. Now following this -
https://tidalcycles.org/index.php/Troubleshooting_a_Tidal_install
I try the following -
justin@justin-XPS-13-9360:~$ cabal update
Downloading the latest package list from hackage.haskell.org
To revert to previous state run:
cabal v2-update 'hackage.haskell.org,2019-11-20T01:17:49Z'
and then -
justin@justin-XPS-13-9360:~$ cabal new-install tidal --lib
{...}
Starting tidal-1.4.4 (lib)
Building tidal-1.4.4 (lib)
Installing tidal-1.4.4 (lib)
Completed tidal-1.4.4 (lib)
Still looks OK, but this is where the problems start -
justin@justin-XPS-13-9360:~$ cabal info tidal
* tidal (library)
Synopsis: Pattern language for improvised music
Versions available: 0.8.2, 0.9.9, 0.9.10, 1.2.1, 1.3.0, 1.4.1, 1.4.2, 1.4.3,
1.4.4 (and 99 others)
Versions installed: [ Not installed ]
Hmm - Not installed ?? And -
justin@justin-XPS-13-9360:~$ ghc-pkg latest tidal
ghc-pkg: cannot find package tidal
Doh. However, if I look in ~/.cabal I can see that some stuff has been installed -
justin@justin-XPS-13-9360:~$ ls -l /home/justin/.cabal/store/ghc-8.6.5/
total 100
{...}
drwxr-xr-x 4 justin justin 4096 Nov 20 06:00 tidal-1.4.4-898a4af91fab9d9d757e1a84104bbd7ca568a77d48b4679a3f4addb65912423a
{...}
and I can even check that the library installed in ~/.cabal/store works properly -
justin@justin-XPS-13-9360:~$ ghci
GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help
Loaded package environment from /home/justin/.ghc/x86_64-linux-8.6.5/environments/default
Prelude> :script /home/justin/.cabal/store/ghc-8.6.5/tidal-1.4.4-898a4af91fab9d9d757e1a84104bbd7ca568a77d48b4679a3f4addb65912423a/share/BootTidal.hs
Listening for controls on 127.0.0.1:6010
tidal> :t d1
d1 :: Pattern ControlMap -> IO ()
tidal>
However I want to use Tidal with its emacs extension -
https://github.com/tidalcycles/Tidal/blob/master/tidal.el
which looks up the package as follows and would require cabal info tidal to return a correctly installed version -
'(("path" . "ghc-pkg describe $(ghc-pkg latest tidal) | grep data-dir | cut -f2 -d' '")
Essentially the emacs extension wants the package to live here (which would make cabal info tidal work)
/home/justin/.cabal/share/x86_64-linux-ghc-8.6.5/tidal-1.4.4/BootTidal.hs
But cabal only seems to "partially" install the package here -
/home/justin/.cabal/store/ghc-8.6.5/tidal-1.4.4-898a4af91fab9d9d757e1a84104bbd7ca568a77d48b4679a3f4addb65912423a/share/BootTidal.hs
Now I could probably hack the emacs extension to point to ~/.cabal/store rather than ~/.cabal/share, but I would prefer this to work properly and cabal info tidal to return the correct version.
Can anyone enlighten me about why cabal is not pushing files to ~/.cabal/share ?
TIA.
cabal v1-installdoes just that, which is whycabal infochecks whether packages are in that database.cabal v2-installdoes not install packages into the global database, so it isn't broken. You should (as far as possible) never install anything into the global database, except for the packages that ship with GHC, and socabal infoshould always say "Not installed." This question is really "how do I point this Emacs extension to anew-installed package?" - HTNWv2-installdoes install packages to a global (aka default) database, doesn't it? - yaxu