Usage of the command line tools

The HaskellCLI package, containing the Haskell for Mac command line tools, installs the following executables in /usr/local/lib/HaskellCLI-<VERSION>/bin/

  • ghc (Glasgow Haskell Compiler),
  • ghci (Glasgow Haskell Compiler REPL),
  • ghc-pkg (Glasgow Haskell Compiler package manager),
  • runghc & runhaskell (Haskell interpreter to run Haskell scripts & programs without compiling them),
  • haddock (Haskell documentation generator),
  • hpc (Haskell coverage checker tool),
  • hsc2hs (lightweight C to Haskell library bridging generator),
  • hp2ps (heap profile to PostScript converter),
  • cabal (Cabal build tool and package manager),
  • cpphs (C-style pre-processor),
  • alex (lexer generator), and
  • happy (parser generator).

The tools ghc, ghci, runghc, and ghc-pkg come in a second versioned variant as well. For example, for GHC 7.10.3, we have ghc and ghc-7.10.3.

Optionally, you can install all tools into /usr/local/bin from the "Command Line" tools tab of the Haskell for Mac app preferences.

Library flavours

As of Version 1.1 of Haskell for Mac and its command line tools, only dynamic libraries and dynamically linked executables are supported. There is not yet support for static linking nor is profiling supported.

Supported packages and package dependencies

Each version of Haskell for Mac and its command line tools is based on a specific version of LTS Haskell. To determine which version of LTS Haskell is used by your installation of Haskell for Mac, see the "About" window in the "Haskell" menu of Haskell for Mac. (In Haskell for Mac 1.4, we use LTS Haskell 6.29.)

When you use cabal install; to install a new package from the online package repository, the installed package and all its dependencies (that are not already bundled with Haskell for Mac) will be downloaded from Stackage Server using the package version that is contained in the LTS Haskell version matching your version of Haskell for Mac. Similarly, if you build and install a local package (possibly one authored by yourself), it is important that all package dependencies can be satisfied from that version of LTS Haskell.

If you need packages not contained in LTS Haskell, you can use cabal command line options to specify other repositories, but this may lead to conflicts that are beyond the scope of what Haskell for Mac support will be able to assist with. Moreover, some packages from LTS Haskell may depend on non-Haskell libraries or tools that may need to be installed separately. Please keep in mind that all software in LTS Haskell is provided by third parties and, while we will endeavour to help wherever possible, we may need to refer you to the maintainers of the respective packages.

Build tools and package executables

All executables installed by packages (such as c2hs) are installed into ~/Library/Haskell/bin. Subsequent package installs will automatically pick them up at this location. However, if you want to manually invoke these executables, you either need to specify the full path to the executable or add ~/Library/Haskell/bin to your PATH environment variable.

Interaction with other Haskell installations 

By default, there is no interaction with other Haskell installations. You you choose to link the the command line tools into /usr/local/bin, other executable in that directory may be overwritten.

Haskell for Mac and its command line tools will always use their own Haskell package database. Packages installed by other tool chains will be ignored and the package database of other tool chains will not be modified.

Have more questions? Submit a request

7 Comments

  • 1
    Avatar
    kidomine

    Hi, you might want to include haddock in the list of executables being installed by Haskell for Mac (see above).

  • 0
    Avatar
    Manuel Chakravarty

    @kidomine, you are very right. It's fixed now. Thank you for pointing out this oversight.

  • 0
    Avatar
    Eric Zoerner

    How would I install layers-0.1 (which is not in the LTS)?

  • 0
    Avatar
    Eric Zoerner

    Is it possible to bring in a module directly from GitHub? This can be done by modifying the `stack.yaml` and `.cabal` files in a normal stack build, but how would I do it with Haskell for Mac?

    Example, bring in the MCPrelude module from the monad challenges:

    In stack.yaml:

    packages:
     
    - .
     
    - location:
     
    git: https://github.com/mightybyte/monad-challenges.git
     
    commit: ba5a6d525c322797c6b54f888c36df8b8bb3adbf
     
    extra-dep: true

    In the cabal file:

     

    build-depends:
     
    base >=4.7 && <5
     
    , monad-challenges

     

     

    Edited by Eric Zoerner
  • 0
    Avatar
    Eric Zoerner

    (Couldn't get the code blocks to format properly) :-(

  • 0
    Avatar
    Manuel Chakravarty

    (Sorry, the formatting support in Zendesk's comment system isn't great.)

    The changes to `stack.yaml` and the Cabal file will work just fine, if you build your Haskell for Mac project with the `stack` command-line tool (which is from 1.6.0 included in the HaskellCLI tools). However, the GUI package manager inside HfM internally uses `cabal install` to do all its work. As a result` the GUI package manager doesn't pick up changes to the `.yaml` file. I understand that this is a limitation and it is definitely one that I want to remove in the future, but at the moment my priority to support all of the functionality of Cabal files from inside the GUI.

    As a work around for now, I would run `cabal install` (using the version of `cabal` from HaskellCLI) inside the GitRepo of `monad-challenges`. This will install that package into the package database used by Haskell for Mac, and you can then import `MCPrelude` without any need to included the sources in your project.

  • 0
    Avatar
    Eric Zoerner

    I got that to work, thanks!

Please sign in to leave a comment.
Powered by Zendesk