1

The stackage set up instructions are:

Download the following file, place it next to your cabal config file and you’re done.

$ wget https://www.stackage.org/lts/cabal.config
$ cabal update
$ cabal install

The problem is I don't know what or where my cabal config file is. Also, does this mean something different if I'm using sandboxes?

Mark Bolusmjak
  • 23,606
  • 10
  • 74
  • 129
  • The `cabal.config` file in the current directory is used for that projects. What you can do is create a project with `cabal init`, then `wget` the stackage `cabal.config`, then whenever you're working on that project with the `cabal` command line tool it will use the stackage servers instead. – bheklilr Apr 09 '15 at 14:32
  • I did that and it doesn't work. `cabal update` says: "Downloading the latest package list from *hackage.haskell.org* Skipping download: Local and remote files match." – Mark Bolusmjak Apr 09 '15 at 14:38
  • 1
    What about a pre-existing ~/.cabal directory. Is that problematic? – Mark Bolusmjak Apr 09 '15 at 14:45

1 Answers1

1

I'm sorry to hear that you're having trouble installing Haskell on OSX. Actually, if you're at this point you're something like 90% of the way there; you've got GHC and cabal installed and that's the big thing that you need to start playing around with the basic elements of Haskell: data declarations, functions, and definitions.

The per-user configuration file should be ~/.cabal/config and the per-project configuration file should be [Project Directory]/cabal.config. (So, as bheklilr states, you'll need to create a project with cabal first.)

You should check and make sure cabal --version is not hopelessly out-of-date; they're on version 1.22 now but if you're > 1.16 you should be able to do the steps above. If not, indeed, the way to upgrade cabal is generally to cabal-update and then cabal install cabal-install to the latest version.

You can of course create your own ~/.cabal/ folder.

CR Drost
  • 9,637
  • 1
  • 25
  • 36
  • All sounds good, but when I try to install something (e.g. in my sandbox I do `cabal install ghc-mod`) I get `cabal: Could not resolve dependencies`. I thought was the whole point of stackage was to resolve such issues. – Mark Bolusmjak Apr 09 '15 at 17:49
  • @z5h What is the constraint that you're getting when cabal complains with that error? – CR Drost Apr 09 '15 at 17:59
  • trying: ghc-mod-5.2.1.2 (user goal) trying: monad-control-1.0.0.4/installed-e5c... (dependency of ghc-mod-5.2.1.2) next goal: transformers-compat (dependency of monad-control-1.0.0.4/installed-e5c...) rejecting: transformers-compat-0.4.0.4/installed-0ef..., 0.4.0.4 (global constraint requires ==0.4.0.3) rejecting: transformers-compat-0.4.0.3 (conflict: monad-control => transformers-compat==0.4.0.4/installed-0ef...) rejecting: transformers-compat-0.4.0.2, 0.3.3.4, 0.3.3.3, 0.3.3.2, 0.3.3, 0.3.2, 0.3, 0.2, 0.1.1.1, 0.1.1, 0.1 (global constraint requires ==0.4.0.3) – Mark Bolusmjak Apr 09 '15 at 18:04
  • @z5h: Okay, it's complaining that you've got transformers-compat-0.4.0.4 installed, but the version in stackage is pinned to transformers-compat-0.4.0.3. (Stackage works by pinning lots of things so this isn't too surprising.) So your problem now is: how did transformers-compat get installed? (possibly by installing GHC?) and secondly, is it safe to remove that package? (probably, if your current version of cabal etc. is the one that ships with stackage). Good luck with figuring all that out. This amount of complication is one reason why Nix was invented. – CR Drost Apr 09 '15 at 18:15
  • 1
    Of course, ask whatever questions you want of me here and I'll still respond, but debugging a wrong-version-of-this-package problem is highly interactive. – CR Drost Apr 09 '15 at 18:16
  • 1
    Before I posted I uninstalled and reinstalled Haskell from http://ghcformacosx.github.io/. Used `cabal init` for 1 project. Did the stackage setup and tried to install ghc-mod and failed. I'm shocked that I'm in a mess already. Have I done something wrong? In what order do I do things? – Mark Bolusmjak Apr 09 '15 at 18:20
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/74874/discussion-between-chris-drost-and-z5h). – CR Drost Apr 09 '15 at 19:42