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
Related
I wanted to use QuickCheck package so i did cabal install QuickCheck and then I got
Warning: You asked to install executables, but there are no executables in
target: QuickCheck. Perhaps you want to use --lib to install libraries
instead.
I then came to know that the right way to do it
cabal install --lib QuickCheck
I tried finding how to make it work after this but not able to find exact way.
I am a beginner so any help would be nice.
Then I tried to to uninstall the package so that I can reinstall using --lib but that also yields problem.
I tried uninstalling using following
cabal uninstall QuickCheck
It gave this message
cabal.exe: This version of 'cabal-install' does not support the 'uninstall'
operation. It will likely be implemented at some point in the future; in the
meantime you're advised to use either 'ghc-pkg unregister QuickCheck' or
'cabal sandbox hc-pkg -- unregister QuickCheck'.
So then I tried this
ghc-pkg unregister --force QuickCheck
Then it says this
ghc-pkg: cannot find package QuickCheck
Any help or comment is appreciated.
You don't need to remove it. Just run
cabal install --lib QuickCheck
It'll tell you it was already up to date, but it also will (silently) mark it as available outside of cabal-managed builds.
Demonstration:
$ ghci
GHCi, version 8.8.3: https://www.haskell.org/ghc/ :? for help
Loaded package environment from /home/carl/.ghc/x86_64-linux-8.8.3/environments/default
Prelude> import Test.QuickCheck
<no location info>: error:
Could not find module ‘Test.QuickCheck’
It is not a module in the current program, or in any known package.
Prelude>
Leaving GHCi.
$ cabal install QuickCheck
Resolving dependencies...
Build profile: -w ghc-8.8.3 -O1
In order, the following will be built (use -v for more details):
- splitmix-0.0.5 (lib) (requires download & build)
- QuickCheck-2.14 (lib) (requires download & build)
Downloading splitmix-0.0.5
Downloaded splitmix-0.0.5
Downloading QuickCheck-2.14
Starting splitmix-0.0.5 (lib)
Downloaded QuickCheck-2.14
Building splitmix-0.0.5 (lib)
Installing splitmix-0.0.5 (lib)
Completed splitmix-0.0.5 (lib)
Starting QuickCheck-2.14 (lib)
Building QuickCheck-2.14 (lib)
Installing QuickCheck-2.14 (lib)
Completed QuickCheck-2.14 (lib)
$ ghci
GHCi, version 8.8.3: https://www.haskell.org/ghc/ :? for help
Loaded package environment from /home/carl/.ghc/x86_64-linux-8.8.3/environments/default
Prelude> import Test.QuickCheck
<no location info>: error:
Could not load module ‘Test.QuickCheck’
It is a member of the hidden package ‘QuickCheck-2.14’.
You can run ‘:set -package QuickCheck’ to expose it.
(Note: this unloads all the modules in the current scope.)
Prelude>
Leaving GHCi.
$ cabal install QuickCheck --lib
Resolving dependencies...
Up to date
carl#DESKTOP-35ES091:~/hask$ ghci
GHCi, version 8.8.3: https://www.haskell.org/ghc/ :? for help
Loaded package environment from /home/carl/.ghc/x86_64-linux-8.8.3/environments/default
Prelude> import Test.QuickCheck
Prelude Test.QuickCheck>
I started with QuickCheck not installed, so ghci gave the error It is not a module in the current program, or in any known package. when I tried to import Test.QuickCheck. After installing it without the --lib option, I got the error It is a member of the hidden package ‘QuickCheck-2.14’. When I installed with the --lib option, it told me it was already up to date, but afterwards importing Test.QuickCheck in ghci worked.
Yeah, ghc-pkg list still doesn't show it. That command seems to be a bit out of date with the way cabal install --lib works now, and how ghc has been updated to make it work.
I have both ghci versions 7.10 and 8 installed on my Ubuntu 16.04. I want to install something based on cabal. I already have cabal installed as the command
cabal --version
yields
cabal-install version 1.22.6.0
using version 1.22.5.0 of the Cabal library
But when I go to update with
cabal update
I get
Downloading the latest package list from hackage.haskell.org
cabal: does not exist
So I am not sure what is going on or how to resolve this. I hope to afterwards install gloss which is based on cabal. But
cabal install gloss-examples
yields
Resolving dependencies...
Downloading bindings-DSL-1.0.23...
Downloading bmp-1.2.6.3...
Failed to install bmp-1.2.6.3
Downloading vector-0.10.12.3...
Build log ( /home/username/.cabal/logs/bmp-1.2.6.3.log ):
cabal: /home/username/.cabal/logs/bmp-1.2.6.3.log: does not exist
EDIT: I originally installed ghci 7.10. Then later installed ghci 8. Could this have any effect?
EDIT2: After installing
cabal install Cabal cabal-install
I still get the same error with
cabal update
Also I still cannot
cabal install gloss-examples
But I get a different error this time
Resolving dependencies...
Downloading bindings-DSL-1.0.23...
Downloading bmp-1.2.6.3...
Failed to install bindings-DSL-1.0.23
Downloading vector-0.10.12.3...
Build log ( /home/aa/.cabal/logs/bindings-DSL-1.0.23.log ):
cabal: /home/aa/.cabal/logs/bindings-DSL-1.0.23.log: does not exist
EDIT3: When I installed Cabal, it says that I installed
Installed cabal-install-1.24.0.2
But when I check with
cabal --version
I am still stuck at
cabal-install version 1.22.6.0
which tells me somehow they are not linked.
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.
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.