After cabal install random, I try ghc-mod list but it still doesn't see the package.
cabal --version
cabal-install version 1.22.6.0
using version 1.22.4.0 of the Cabal library
ghc-mod --version
ghc-mod version 5.5.0.0 compiled by GHC 7.10.3
I have now also tried adding random-1.1 to my global stack.yaml (trying to make a simple script here...) and installed via stack install random to no avail.
My file seems to run fine with runhaskell though.
When you type stack install random, and then run stack ghci or install with stack, the import succeeds
> import System.Random --succeeds
If you run ghc outside of stack, it won't necessarily use the same setup.
Related
I'm new to Haskell, and have found the :type command in the ghci REPL to be really useful for interactively figuring out how things work. So far I've only used things from the base package, but now I'd like to use something from distributive with the :type command in the REPL.
How in the world do I do this? If it matters, I'm on macOS and have done brew install ghc cabal-install. But nothing I've tried will either install or import the distributive package, and the error messages are not very good. I've found lots of related questions and documentation, but nothing shows a worked example, and I'm unable to infer what commands to use.
I eventually figured this out. The missing pieces were needing to first update cabal (even though I had just installed it), and to use --lib as an argument when installing:
brew install ghc cabal-install
cabal update
cabal install --lib distributive
ghci
import Data.Distributive
Recently Installed VS Code in my Ubuntu14.04 . Installed Haskell using Stack.
Getting these errors. Kindly help.
Error: Couldn't start ghc-mod process Error: Command failed: ghc-mod version
Error: Cannot hlint the haskell file. The hlint program was not found. Use the 'haskell.hlint.executablePath' setting to configure the location of 'hlint'
It looks like you've installed 2 extensions for vscode, one for linting and one for running ghc-mod, but you don't have hlint or ghc-mod installed.
If you are using this ghc-mod extension, make sure you have ghc-mod installed through cabal or through stack.
IF you are using this linter extension, make sure you have hlint installed through cabal or through stack.
To install with cabal, run:
cabal install hlint
and
cabal install ghc-mod
To install via stack, see the stack documentation.
When I tried loading a module containing import Control.Monad.State
I got
Could not find module ‘Control.Monad.State’
Perhaps you meant
Control.Monad.ST (from base-4.8.2.0)
Control.Monad.ST.Safe (from base-4.8.2.0)
Control.Monad.Fix (from base-4.8.2.0)
Use -v to see a list of the files searched for.
Failed, modules loaded: none.
I installed the Haskell Platform, which has cabal and mtl installed.
When I run cabal update and then cabal install mtl:
Resolving dependencies...
All the requested packages are already installed:
mtl-2.2.1
Use --reinstall if you want to reinstall anyway.
I tried the reinstall flag but it just keeps giving me warnings that I will break other packages so I didn't continue.
My ghc --version is version 7.10.3. cabal --version is 1.22.5.0
This is what I got when I ran ghc-pkg list mtl:
WARNING: cache is out of date: Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/package.conf.d/package.cache
ghc will see an old view of this package db. Use 'ghc-pkg recache' to fix.
/Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/package.conf.d
mtl-2.2.1
And when I ran ghc-pkg check :
WARNING: cache is out of date: /Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/package.conf.d/package.cache
ghc will see an old view of this package db. Use 'ghc-pkg recache' to fix.
And when I ran ghc-pkg recache
ghc-pkg: /Library/Frameworks/GHC.framework/Versions/7.10.3-x86_64/usr/lib/ghc-7.10.3/package.conf.d/package.cache: you don't have permission to modify this file
I want to try doing regexes in GHCi. I tried loading the module
:mod +Text.Regex.Posix
But got this error instead
<no location info>:
Could not find module ‘Text.Regex.Posix’
It is not a module in the current program, or in any known package.
But I should have Text installed
ghc-pkg find-module Text.Regex.Posix would give me
/usr/local/Cellar/ghc/7.8.4/lib/ghc-7.8.4/package.conf.d
/Users/a/.ghc/x86_64-darwin-7.8.4/package.conf.d
What do I do?
I have no problem with this though:
import Text.Read
Why?
The problem is that you simply don't have the regex-posix package installed. This is the package that exports the Text.Regex.Posix module. Text.Read is exported by the base package which comes with every Haskell distribution.
You can see this by running ghc-pkg find-module Text.Read. To install the regex-posix package globally run the command cabal install regex-posix. If you don't want to install it globally or run into problems getting it to install, it would be better to try installing it with the same command in a sandbox after running cabal sandbox init in the directory of your choice.
This error message failing my installation of haskell-src-exts-1.15.0.1
ld: library not found for -lHScpphs-1.18.5-ghc7.8.2
So I guess my cpphs is missing. When I tried to install cpphs, however
$ cabal install cpphs
Resolving dependencies...
All the requested packages are already installed:
cpphs-1.18.5
Use --reinstall if you want to reinstall anyway.
The similar error happens for text-1.1.1.3.
I have tried erasing everything and reinstalling haskell-platform but it doesnt work.
I use haskell-platform installed from homebrew, but I had already had the latest version of cabal and ghc
λ ~/cabal --version
cabal-install version 1.20.0.3
using version 1.20.0.1 of the Cabal library
λ ~/ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.2
find ing the *.dylib gives no result.