Leksah system scope module browser is empty - browser

I have just installed leksah following the user manual. The manual says that I should do a ghc-pkg recache before starting Leksah for the first time, or I might see an empty module browser at the system scope. My problem is that this is what I am seeing, even though I did the recache.
Basically, my setup process was this: Leksah install -> ghc-pkg recache -> starting Leksah. Then I get to a screen which tells me that Leksah will collect and download metadata for my installed packages, and warns me that it might take long time. Using the recommended defaults there, I see a progress bar for about five seconds, and then Leksah starts. These defaults were:
No paths for haskell package sources.
Prebuild metadata URL: http://www.leksah.org.
Retrieve, then build.
Server port: 11111.
End server with last connection.
Reading on in the manual, it says that the location of haskell package sources could be omitted (which was the default), if I just wanted to test, and the location could be filled in later. This leads me to believe that the missing Haskell source paths are the problem, but then I don´t know where my haskell sources are. They don´t seem to be in the Haskell Platform folder. Does anybody know how to solve this?
Other stuff, which might help:
I have grep on my path as well as wget, as specified in the manual.
The ghc-pkg recache command takes about a second. I don´t know, if it should be more.
Doing a Rebuild Metadata, I get a console with a lot of numbers from 0 to 1 for update_toolbar, and then a lot of "starting server" -> "metadata collector has nothing to do" -> "metadata collection has finished".
my setup:
win xp sp3
ghc 6.12.3
Leksah 0.8.0.6
GNU grep 2.5.4
GNU wget 1.5.3.1
I´ll be happy to provide more information. Thank you.

In the preferences under metadata you need to put the path to package sources in the section "Paths under which Haskell source for package maybe found", they should be under your home path in .cabal directory. For me this was "/home/korcan/.cabal" then restart Leksah, if that doesn't work you might need to rebuild system data.
I think I had problems getting this to work except when I re-installed Leksah and it asks you to add those settings for the first time.
EDIT: okay I just read you're using XP, this will be somewhere in your Docs & Settings directory, on windows 7 for me it's in C:\Users\user-name\AppData\Roaming\cabal

Related

Idris/cabal install issues from removePathRecursive on Windows

Installing Idris on Windows 10 using instructions to:
Install Haskell following this
Replaced , with ; in multiline paths of config files as reported by #gergelybat in this
c:\Users\me\cabal update
c:\Users\me\cabal install idris
Several dependency errors arise, I follow Idris' instructions to apply with blind faith the following further flags
----reinstall
--avoid-reinstalls
--force-reinstalls
--upgrade-dependencies
Progress is made things begin to be built, we get all the way to building a temp directory with something called idris-1.3.1\…\setup.exe
Then we crash with following error:
C:\Users\me\AppData\Local\Temp\cabal-tmp-26128\idris-1.3.1\dist\setup: removeDirectoryRecursive:
…": unsatisfied constraints (The directory is not empty.)
Googling this I find this same error happens across cabal installs and logged as issues on oodles of GitHub projects. Theories are all over the map and no solutions provided. The Haskell documentation on removeDirectoryRecursive offers a clue ending with the remark that this fails on Windows if the directory is a symbolic-link.
How does one get past this problem to finish an install?
This is mostly to record the steps that worked, thanks to Michael Sonyman for the major tip.
Steps to follow.
Install Haskell (with Stack) following this
Replace , with ; in multiline paths of config files as reported by #gergelybat in this
Check that you have a version of make by checking stack exec -- which make
if you get no make then install GnuWin32,
ensure that the install directory for (e.g. c:\Program Files (x86)\GnuWin32\bin is added to your system path (follow "set environment variables").
Restart PowerShell/Command prompt, retry step 3, you should see a make found, if not recheck your steps.
Run stack install --resolver lts-12.26 idris … this may be very slow. It ends by copying the Idris compiler and other items to C:\Users\you\AppData\Roaming\local\bin:
Test by typing idris at prompt, it should load the Idris REPL.
Enjoy dependent typing for the rest of your programming life.
You could try using cabal new-build or cabal new-install, but I am not sure if that will work.

Troubles installing Haskell Platform

I was trying to to install Haskell Platform 2014 2.0 but I can't really understand what am I supposed to do to make it work and there seems to be no useful documentation on the site.
I downloaded the binary dist from the site, unpacked it, launched the 'activate-hs' script and got this:
Haskell set to:
GHC /home/riccardo/usr/local/haskell/ghc-7.8.3-x86_64
Haddocks file:///home/riccardo/usr/local/haskell/ghc-7.8.3-x86_64/doc/frames.html
Other doc file:///home/riccardo/usr/local/haskell/ghc-7.8.3-x86_64/share/doc/ghc/html/index.html
Symlinks for command line tools (ghc, cabal, etc..) added to:
/usr/local/bin
Even running in --verbose tells me nothing more about what's going on, it just returns a list of all the files.
What should I do?
EDIT:
riccardo#eos:~$ whereis ghc
ghc: /usr/local/bin/ghc
If I go to /usr/local/bin the symlinks are there and they point to the respective files in /home/riccardo/usr/local/haskell/ghc-7.8.3-x86_64/bin, but in the property window it says they are broken, what does this mean?
Also, if I get into home/riccardo/usr/local/haskell/ghc-7.8.3-x86_64/bin and try to launch the scripts directly from there, it still won't work:
riccardo#eos:~/usr/local/haskell/ghc-7.8.3-x86_64/bin$ ./ghci-7.8.3
./ghci-7.8.3: line 2: /usr/local/haskell/ghc-7.8.3-x86_64/bin/ghc-7.8.3: File o directory non esistente
File o directory non esistente = file or directory does not exist
For posterity, if you're installing the generic-linux binary package as this appears to be describing, you cannot just run activate-hs. Rather you run install-haskell-platform.sh which puts everything in the proper place. Following that, you can use the installed activate-hs in the future if you want to swap between different versions...

NixOS and ghc-mod - Module not found

I'm experimenting a problem with the interaction between the ghc-mod plugin in emacs, and NixOS 14.04. Basically, once packages are installed via nix-env -i, they are visible from ghc and ghci, recognised by haskell-mode, but not found by ghc-mod.
To avoid information duplication, you can find all details, and the exact replication of the problem in a VM, in the bug ticket https://github.com/kazu-yamamoto/ghc-mod/issues/269
The current, default, package management set up for Haskell on NixOS does work will with packages that use the ghc-api, or similar (ghc-mod, hint, plugins, hell, ...) run time resources. It takes a little more work to create a Nix expression that integrates them well into the rest of the environment. It is called making a wrapper expression for the package, for an example look at how GHC is installed an operates on NixOS.
It is reasonable that this is difficult since you are trying to make a install procedure that is atomic, but interacts with an unknown number of other system packages with their own atomic installs and updates. It is doable, but there is a quicker work around.
Look at this example on the install page on the wiki. Instead of trying to create a ghc-mod package that works atomically you weld it on to ghc so ghc+ghc-mod is an atomic update.
I installed ghc+ghc-mod with the below install script added to my ~/.nixpkgs/nixpkgs.nix file.
hsEnv = haskellPackages.ghcWithPackages (self : [
self.ghc
self.ghcMod
# add more packages here
]);
Install package with something like:
nix-env -i hsEnv
or better most of the time:
nix-env -iA nixpkgs.haskellPackages.hsEnv
I have an alias for the above so I do not have to type it out every time. It is just:
nixh hsEnv
The down side of this method is that other Haskell packages installed with nix-env -i[A] will not work with the above installation. If I wanted to get everything working with the lens package then I would have to alter the install script to include lens like:
hsEnv = haskellPackages.ghcWithPackages (self : [
self.ghc
self.ghcMod
self.lens
# add more packages here
]);
and re-install. Nix does not seem to use a different installation for lens or ghc-mod in hsEnv and with the ghc from nix-env -i ghc so apparently only a little more needs to happen behind the scenes most of the time to combine existing packages in the above fashion.
ghc-mod installed fine with the above script but I have not tested out its integration with Emacs as of yet.
Additional notes added to the github thread
DanielG:
I'm having a bit of trouble working with this environment, I can't even get cabal install to behave properly :/ I'm just getting lots of errors like:
With Nix and NixOS you pretty much never use Cabal to install at the global level
Make sure to use sandboxes, if you are going to use cabal-install. You probably do not need it but its there and it works.
Use ghcWithPackages when installing packages like ghc-mod, hint, or anything needs heavy runtime awareness of existing package (They are hard to make atomic and ghcWithPackages gets around this for GHC).
If you are developing install the standard suite of posix tools with nix-env -i stdenv. NixOS does not force you to have your command line and PATH cultured with tools you do not necessarily need.
cabal assumes the existence a few standard tools such as ar, patch(I think), and a few others as well if memory services me right.
If you use the standard install method and/or ghcWithPackages when needed then NixOS will dedup, on a package level (If you plot a dependency tree they will point to the same package in /nix/store, nix-store --optimise can always dedup the store at a file level.), many packages automatically unlike cabal sandboxes.
Response to comment
[carlo#nixos:~]$ nix-env -iA nixos.pkgs.hsEnv
installing `haskell-env-ghc-7.6.3'
these derivations will be built:
/nix/store/39dn9h2gnp1pyv2zwwcq3bvck2ydyg28-haskell-env-ghc-7.6.3.drv
building path(s) `/nix/store/minf4s4libap8i02yhci83b54fvi1l2r-haskell-env-ghc-7.6.3'
building /nix/store/minf4s4libap8i02yhci83b54fvi1l2r-haskell-env-ghc-7.6.3
collision between `/nix/store/1jp3vsjcl8ydiy92lzyjclwr943vh5lx-ghc-7.6.3/bin/haddock' and `/nix/store/2dfv2pd0i5kcbbc3hb0ywdbik925c8p9-haskell-haddock-ghc7.6.3-2.13.2/bin/haddock' at /nix/store/9z6d76pz8rr7gci2n3igh5dqi7ac5xqj-builder.pl line 72.
builder for `/nix/store/39dn9h2gnp1pyv2zwwcq3bvck2ydyg28-haskell-env-ghc-7.6.3.drv' failed with exit code 2
error: build of `/nix/store/39dn9h2gnp1pyv2zwwcq3bvck2ydyg28-haskell-env-ghc-7.6.3.drv' failed
It is the line that starts with collision that tells you what is going wrong:
collision between `/nix/store/1jp3vsjcl8ydiy92lzyjclwr943vh5lx-ghc-7.6.3/bin/haddock' and `/nix/store/2dfv2pd0i5kcbbc3hb0ywdbik925c8p9-haskell-haddock-ghc7.6.3-2.13.2/bin/haddock' at /nix/store/9z6d76pz8rr7gci2n3igh5dqi7ac5xqj-builder.pl line 72.
It is a conflict between two different haddocks. Switch to a new profile and try again. Since this is a welding together ghc+packages it should not be installed in a profile with other Haskell packages. That does not stop you from running binaries and interrupters from both packages at once, they just need to be in their own name space so when you call haddock, cabal, ghc, there is only one choice per profile.
If you are not familiar with profiles yet you can use:
nix-env -S /nix/var/nix/profiles/per-user/<user>/<New profile name>
The default profile is either default or channels do not which one it will be for your set up. But check for it so you can switch back to it later. There are some tricks so that you do not have to use the /nix/var/nix/profiles/ directory to store you profiles to cut down on typing but that is the default location.

Leksah does not show any modules

I have installed Leksah 0.12.0.3 on Windows 8 in C:\Leksah and the latest Haskell Platform in C:\HaskellPlatform.
I created a new workspace and package and added a module of my own (distinct from the Main one that Leksah creates). I can import and use this new module in the Main module, however Leksah does not show it in the right Browser pane no matter what I do - it only lists the Main module there. If I switch to System, that list is empty.
I have tried:
reinstalling Leksah and the Haskell Platform;
running ghc-pkg recache in a cmd ran as admin;
putting my workspace and package in paths without spaces.
Still, no luck. Also, in the console that opens along with Leksah, I see this when my workspace / package open:
Using default Yi configuration
Warning: D:\Haskell\TestPackage\TestPackage.cabal: A package using section
syntax must specify at least
'cabal-version: >= 1.2'.
Now updating system metadata ...
***server start
Bind 127.0.0.1:26411
Metadata collector has nothing to do
Metadata collection has finished
Now loading metadata ...
Now updating workspace metadata ...
Can't extract module C:\Users\Vlad\.leksah-0.12\metadata\TestPackage-1\Test.lksh
e <command line>: cannot satisfy -package -db
(use -v for more information)
Finished
>>>Info Changed!!! True
Also, under Configuration -> Edit Prefs -> Metadata, "Paths under which haskell sources for packages may be be found" is empty. Should I put something there, and if yes, what?
I don't know what to try anymore. How can I get Leksah working right?
I had someone suggest that your leksah needs to be compiled with the same version of GHC as the one you have on your system. I haven't tried it, but even if it's true, I think that is really silly and shows that leksah may not be mature enough yet, at least not for my comfort. Not to mention that this could easily be detected and the user notified.
So, I ended up using Eclipse FP, which works great.

Help with running the Yesod Development server?

I'm currently trying out web development frameworks for haskell and I recently came across yesod. It seemed pretty interesting so I installed it using cabal, however I'm not able to run the development server. Following their getting started instructions here's the result:
$ yesod init
$ cd mysite
$ yesod devel
Configuring mysite-0.0.0...
Testing files...
Rebuilding app
yesod: bind: resource busy (Address already in use)
Preprocessing library mysite-0.0.0...
Preprocessing executables for mysite-0.0.0...
Building mysite-0.0.0...
Controller.hs:16:7:
Could not find module `Data.Dynamic':
It is a member of the hidden package `base'.
Perhaps you need to add `base' to the build-depends in your .cabal file.
It is a member of the hidden package `base-3.0.3.2'.
Perhaps you need to add `base' to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
Testing files...
Testing files...
^^ above line just keeps repeating...
I'm assuming it has something to do with the Data.Dynamic module but I don't know how to go about fixing it.
Additional Info
Running Ubuntu 10.10 Maverick
ghc version:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.1
I haven't run into this specific issue, but the error message looks like it's a simple question of GHC being unable to find version 3.0.3.2 the package "base." This version has been buildable since GHC 6.9, so you should have it. Try running the following command:
ghc-pkg check
This will tell you if there is something wrong with your packages. Cabal can be a bit of a nightmare for dependencies -- partly, it seems, because a lot of Haskell developers underestimate the extent to which their underlying libraries will shift in the future. So they will define a dependency as ">= [version of package x]" without limiting the max version to the one presently available. Or they just leave out version-limiting altogether.
Yesod, I'm happy to say, doesn't fall into this trap. But several of the libraries it depends on do. When you start developing in Haskell, learn this lesson: never assume that future versions of a library won't break your code. They will. A lot.
If ghc-pkg comes up with broken packages, you may need to clean up/uninstall/reinstall these packages until they are either cleaned up or hidden. (Just do ghc-pkg hide [package name] to tell ghc to ignore that package.
Your next problem is that hidden base package. Try the following:
ghc-pkg list | grep base
If you see brackets around the library, that means it's hidden. The package base-3.0.3.2 might show up as hidden (although that's a bit unlikely, as that's where the backward-compatible Prelude lives). If it is hidden, try to unhide it with the following command:
ghc-pkg expose base-3.0.3.2
Now try re-running yesod devel and see how it goes. Best case scenario is that it works. If not, let us know.
According to the Yesod in Five Minutes guide, you appear to be missing the a call to the command "cabal install" between your "cd mysite" and "yesod devel". It may need to install further packages based on what your responses were during "yesod init", such as which database you want to use.
Also, you may want to check that the port is not currently being used, as you have the "Address already in use" shown in your transcript.
First, it would be a good idea to resolve any broken packages reported by ghc-pkg check, by removing/reinstalling/upgrading them.
Next, can you manually cabal build the mysite app without trouble ? If your mysite.cabal actually does not specify base in the build-depends list, you should follow the suggestion to add that.
The repeating Testing Files message is normal for current yesod devel, it is polling your source files.

Resources