I am trying to install Haskell on my Macbook two days and can not get the success.
What I have done:
$ brew install ghc
Fine. Now I am trying to install
$ cabal install text
and get next error messages:
Data/Text.hs:1074:4: error: invalid preprocessing directive #-} ^
I have googled and found this.
So:
brew install gcc48
$ /usr/local/bin/gcc-4.8 --version gcc-4.8 (GCC) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ cat /usr/local/lib/ghc-7.6.3/settings [("GCC extra via C opts", " -fwrapv"), ("C compiler command", "/usr/local/bin/gcc-4.8"), ("C compiler flags", " -m64 -fno-stack-protector -m64"), ...
brew install cabal-install
And I get the same messages.
How can I fix them ?
Run the command "$ sudo apt-get install haskell-platform" and press Enter. It will automatically start downloading Haskell on your system after authenticating you with the root password. After installing, you will receive a confirmation message.
If you have installed the Haskell Platform, open a terminal and type ghci (the name of the executable of the GHC interpreter) at the command prompt. Alternatively, if you are on Windows, you may choose WinGHCi in the Start menu. And you are presented with a prompt. The Haskell system now attentively awaits your input.
brew install ghc cabal-install
If you prefer homebrew.
Note: (Edited to add) Homebrew may have an older (or newer) version of ghc than the Haskell Platform download for OSX, and there might be other differences. You can check the release notes here for the version included in Haskell Platform, as well as other information of interest. brew info ghc cabal-install
will give you up to date information about Homebrew's versions.
Note: The last time I did this, I just installed haskell-stack instead, as described in Filippo's answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With