News for hackers. Stuff that matters.
Re:Why inbreeding is bad for your community by jmillikin on Sunday October 28, 2012 @01:25PM (#4709413)
(reposting my comment from Reddit)

I don't understand why he wanted to reinstall things so often; it would have been much easier (and certainly faster) to just install libraries once.

The first problem is that he didn't read any of the Cabal documentation. He complains that after upgrading his Cabal binary, that it still complains that an update is needed. I'm almost certain this is because he hasn't put the Cabal binary directory (~/.cabal/bin) on his $PATH. While this is arguably something that Cabal should be detecting and warning about, it's also not a requirement unique to Haskell -- any package manager that installs to a user's home directory will need them to change their $PATH.

Continuing on, he installs cabal-dev (good!), then proceeds to not use it. Instead, he tries to jam all of Yesod (a notoriously version-picky package) into his global package directory.

Then he uses cabal-dev to build his new site, and here's where things get weird. It should absolutely not install anything other than what his particular package needs as dependencies. If it's installing the world again, then there is something horribly misconfigured on his system.

Finally, I strongly object to Yesod being considered a "success story". While web frameworks are currently the hip thing, and Yesod is indeed a web framework, to my knowledge it's gained no significant userbase in part due to the huge nest of conflicting library versions that it depends on.

Here's what he needs to do:

  # Clean up whatever mess he's currently made
  $ rm -rf ~/.cabal ~/.ghc

  # Re-initialize Cabal
  $ export PATH="$HOME/.cabal/bin:$PATH" # optionally add to .bashrc
  $ cabal update
  $ cabal install cabal-install cabal-dev

  # Assuming that Yesod is using standard Haskell packaging properly, this
  # should install Yesod in its own little sandbox so it won't destroy the rest
  # of the system.
  $ mkdir my-yesod-project
  $ cd my-yesod-project
  $ export PATH="$PWD/cabal-dev/bin:$PATH"
  $ cabal-dev install yesod

  # Now Yesod can be used without fear
  $ yesod init .
  $ cabal-dev install
Re:Why inbreeding is bad for your community by dllthomas on Sunday October 28, 2012 @01:46PM (#4709467)
Ideally, getting a basic setup going shouldn't take a deep-read of the docs of my package manager. This is absolutely a weakness of the current Haskell ecosystem; perhaps not as bad as presented in the post here, but something that deserves improvement.

Contrary to the thesis of the post, the haskell community seems to be well aware of this, and there are several attempts to fix it being actively worked on, just nothing particularly standardized yet. Meanwhile, cabal-dev lets people get work done.

Re:Why inbreeding is bad for your community by jmillikin on Sunday October 28, 2012 @01:52PM (#4709495)

  > Ideally, getting a basic setup going shouldn't take a
  > deep-read of the docs of my package manager.
Please name one package manager which installs binaries to the user's home directory, but doesn't require updating the user's $PATH.
Re:Why inbreeding is bad for your community by tedivm on Sunday October 28, 2012 @02:06PM (#4709527)
>>Ideally, getting a basic setup going shouldn't take a deep-read of the docs of my package manager.

>Please name one package manager which installs binaries to the user's home directory, but doesn't require updating the user's $PATH.

Do you even realize how little those two statements follow each other? The whole red herring argument here is kind of annoying, but I'll hit it anyways- every package manager that I've used which installs binaries (or anything, really) in the user's home directory (or any directory really) does make me update the path- but it also tells me this and gives me sane errors when that hasn't happened.

Re:Why inbreeding is bad for your community by jmillikin on Sunday October 28, 2012 @02:10PM (#4709535)
In my experience, other package managers (my experience is with Python's and Ruby's) will behave just like Haskell's. Specifically, they do not seem to inspect the user's $PATH variable to determine whether their default installation directory is present.
Re:Why inbreeding is bad for your community by wowzer on Sunday October 28, 2012 @02:51PM (#4709633)
Having used both Haskell's package manager cabal and Python's pip and easy_install. Cabal has a long way to go before it's anything like pip. You can see cabal moving in the right direction, but pip is leagues ahead of it right now, especially when using virtualenv.
Re:Why inbreeding is bad for your community by jmillikin on Sunday October 28, 2012 @03:26PM (#4709725)
In what ways do you find pip better than cabal, or pip+virtualenv better than cabal-dev?
Re:Why inbreeding is bad for your community by carterschonwald on Sunday October 28, 2012 @02:35PM (#4709590)
I agree with everything you have posted.
Re:Why inbreeding is bad for your community by jackcviers3 on Sunday October 28, 2012 @02:59PM (#4709652)
1. npm When installing packages with the --local flag, the npm package manager moves up the pwd path, looking for a node_modules directory. Once installed there, packages can be required by package name in dependent scripts. Common use case is to put a node_modules directory in your home directory to keep multi-project development dependencies out of your global system node install.

2. Ivy/Maven. Dependencies are placed in ~/.ivy, and are available for use without changing environment variables.

3. rubygems. A ~/.gems directory is created that provides dependencies by ruby version, if you wish.

Now, running a clis still requires an addition to path. But package managers do exist that organize dependencies on the user path without explicit environment variable edition.

Re:Why inbreeding is bad for your community by jmillikin on Sunday October 28, 2012 @03:24PM (#4709719)
Cabal does not require editing $PATH to use newly-installed libraries.

The problem he reports is that when he upgrades the Cabal binary by running 'cabal install cabal-install', the sequence of events is:

1. The system runs /usr/bin/cabal

2. Cabal fetches and builds the new binary

3. The new binary is installed to $HOME/.cabal/bin/

4. When he runs 'cabal update' again, it still uses /usr/bin/cabal because $HOME/.cabal/bin/ is not on his $PATH

Re:Why inbreeding is bad for your community by graue on Sunday October 28, 2012 @04:42PM (#4709913)
Sounds like pip (popular package manager for Python) avoids this problem because you don't use pip to install or upgrade itself. If using the package manager to install updated versions of itself is an intended use case, then I agree with others: it should check your path after the install and make sure the newly installed binary is the one that will get used. Otherwise the design is making it too easy to do the wrong thing.
Re:Why inbreeding is bad for your community by dllthomas on Sunday October 28, 2012 @02:45PM (#4709617)
You think that's the only potential gotcha when using cabal-install?
Re:Why inbreeding is bad for your community by codewright on Sunday October 28, 2012 @03:01PM (#4709656)
leiningen