Could not find module `Test.QuickCheck' on Ubuntu - testing

I'm importing QuickCheck at the top of my file:
import Test.QuickCheck
...
Compiling the file with ghc Lab1.hs gives me this error:
Lab1.hs:1:8:
Could not find module `Test.QuickCheck'
Use -v to see a list of the files searched for.
Failed, modules loaded: none.
I tried an apt-cache search for quickcheck and got a dire list of packages. Tried installing libghc-test-framework-dev just because I thought the name seemed appropriate, but the error persists.
How do I install the QuickCheck module?

If you're interested in managing your Haskell packages outside of your package manager (which may be beneficial if you're interested in using the latest versions of things) then Cabal is the Haskell package manager which would allow you to do
apt-get install cabal-install
cabal update
cabal install QuickCheck
to make QuickCheck available globally.
What's more recommended of late however is to use the sandbox feature of Cabal. This is very similar to Python's virtualenv or Ruby's bundle if you're more familiar with those. To do this, you must create a "cabalized" project
cabal init # in an empty directory
and then put QuickCheck (and your other library dependencies) in the build-depends: slot of the generated <folder name>.cabal file.
After you've done this you use Cabal for all further package management and compilation commands.
cabal sandbox init # creates your local package sandbox
cabal install --only-dependencies # gets and installs all the build-dependencies
cabal repl # starts up GHCi in the local sandbox
cabal build # configures and builds the local project
cabal sandbox delete # cleans up the sandbox

In Ubuntu 14.04.1:
sudo apt-get install libghc-quickcheck2-dev
Before:
> :m +Test.QuickCheck
<no location info>:
Could not find module `Test.QuickCheck'
It is not a module in the current program, or in any known package.
After:
Prelude> :m +Test.QuickCheck
Prelude Test.QuickCheck>

Related

rpm build with local Required: some_local_package.rpm

Requires: in the spec files sets the package dependencies, but what will happen if the repo of the requirements is not in the repolist?
Is there a way to use pre downloaded rpm files and tell the rpmbuild that the dependencies should be installed from the local file like yum localinstall.
You're conflating rpm and yum when you mention repolist.
rpm is a lower level and only knows about RPM files
yum collects sets of RPMs into repositories and sits on top of RPM to handle dependencies
Now, to answer the question - rpmbuild does not need anything from the Requires field to build the RPM. If it does, then the RPMs should be listed as BuildRequires in the specfile and only be in Requires if the end user needs it to be installed to run the final product. For example, to build you might need foo-devel but at runtime you only need libfoo. Those should be declared appropriately.
Even if you fix the Requires vs. BuildRequires fields, it still won't help you - rpmbuild cannot install RPMs itself because you should never run rpmbuild as root. An error in a specfile can very easily nuke an entire machine if it's run as root.

Install modules in other rakudo versions using rakubrew

When upgrading rakudo version using rakubrew, is pretty easy to change versions, but I wnat to know if it is posible to import raku modules from the older version to the new version. doign zef install automatically:
to update:
rakubrew build 2020.10
but then:
❯ raku
Welcome to 𝐑𝐚𝐤𝐮𝐝𝐨™ v2020.10.
Implementing the 𝐑𝐚𝐤𝐮™ programming language v6.d.
Built on MoarVM version 2020.10.
You may want to `zef install Readline` or `zef install Linenoise` or use rlwrap for a line editor
To exit type 'exit' or '^D'
so I need to install all modules that I currently use:
rakubrew build-zef
zef install Sparrow6
zef install Linenoise
so exists any file .zef or .rakubrew or something that checks to maintain this modules automatically
You can get the list of installed modules using zef list --installed. Note you probably want to ignore the share/perl6 repo, as the CORE module included in it is specific to each version of rakudo.
see: https://github.com/ugexe/zef#list-from
list [*#from]
List known available distributions
$ zef --installed list
===> Found via /home/nickl/.rakubrew/moar-master/install/share/perl6/site
CSV::Parser:ver<0.1.2>:auth<github:tony-o>
Zef:auth<github:ugexe>
===> Found via /home/nickl/.rakubrew/moar-master/install/share/perl6
CORE:ver<6.c>:auth<perl>
Alternatively you can use the following one-liner to get a list:
$ raku -e 'say $*REPO.repo-chain.grep(CompUnit::Repository::Installation).map(*.installed.Slip).grep(*.defined).map({ CompUnit::Repository::Distribution.new($_).Str }).join(" ")'
Text::Table::Simple:ver<0.0.7>:auth<github:ugexe>:api<> CSV::Parser:ver<0.1.2>:auth<github:tony-o>:api<> CORE:ver<6.d>:auth<perl>:api<>
# $*REPO.repo-chain.grep(CompUnit::Repository::Installation) # Get only repos for installed raku modules
# .map(*.installed.Slip) # Get a list of installed modules for this repo, and Slip it into the outer singular results list
# .grep(*.defined) # Some repos will have had no modules, so remove these undefined entries
# .map({ CompUnit::Repository::Distribution.new($_).Str }) # Use CompUnit::Repository::Distribution to get at the normalized identifier
# .join(" ") # Join the results together
Once you have chosen a way to create a list of what needs to be installed you can just pass that list to zef (although your shell may require you to quote names passed in explicitly on the command line)
rakubrew installs different Raku versions in different directories $HOME/.rakubrew/versions/moar-*
So each Raku version has its own separate Installation repositories ( site, vendor, ... ).
And because zef installs distributions to site repo by default, I think. So the modules are not available under multiple versions.
However, because Raku uses the home Installation repo (#inst/home/user-name/.raku) and it exists in repo-chain so you can install the modules you want available on all versions to home repo (~/.raku). ( the modules will be precompiled the first time useed in a new Raku version ).
Please note I haven't tested that with zef but I use Pakku which installs to home repo by default, and the modules I install to home are available to all rakubrew Raku versions on my Linux machine.

What's the build script for a module distribution?

I have test failures. I want to see the details and experiment and perhaps debug, so I unpack the module dist. Now I expect to find some analogue to Setup.hs, setup.py, Build.PL, Rakefile etc., but there are no executables. How do you manually build and test verbosely?
Installing modules
First I'd check more into zef
zef install module::name
zef test /path/to/module
zef --help
zef comes with Rakudo-Star.
If you make a change and want to reinstall the module with the change and it doesn't want to install it, you can "force" it:
zef install --force-install ./relative/path/to/module
Or, if you bump the version in META6.json, you don't have to force it:
zef install ./relative/path/to/module
Testing modules
To test a module, you can use prove to run all of the tests in its test directory:
prove --exec=perl6 -r t/
To run an individual test, simply use perl6:
perl6 t/test.t
See also
Running Tests
You also might be interested in 6pm, but I don't have enough experience with it to comment on it at this time.

How to provide standard library sources for IntelliJ IDEA's Rust project?

I am using Mac for development. I installed Rust 1.13.0 using brew install rust and the Rust plugin 0.1.0.1385 for IntelliJ IDEA. I created my first test project with cargo and while opening it with IDEA I got the message
No standard library sources found, some code insight will not work
I haven't found any sources installed, nor the Rust sources package in Homebrew.
How do I provide sources for the project and what are the practical implication if I ignore this step?
As commented, the supported approach is to use rustup:
Navigate to https://rustup.rs/ and follow the installation instructions for your platform.
Add the rust-src component by running: rustup component add rust-src
Create a new Rust project in IntelliJ and choose your existing Rust project source. If the folder already contains previous IntelliJ project files, you may have to delete those first before it will let you proceed.
IntelliJ-Rust should automatically configure the standard library sources to point to the sources downloaded by rustup.
As a reference, since the question title is broad, for Fedora 28 I had to:
dnf install cargo rust-src
sudo ln -s /usr/lib/rustlib/src /usr/lib/rustlib/x86_64-unknown-linux-gnu/
then give /usr/lib/rustlib/x86_64-unknown-linux-gnu/src/rust/src as "Standard library"
Full setup:
Issue opened to simplify the process
When not using the rustup installer, one can install the source package and direct the rust plugin to use those:
(Tested with CLion 2020.2.1, rust-1.46.0-x86_64-pc-windows-gnu.msi, rustc-1.46.0-src.tar.gz. Offline Rust installers and source archive from there: https://forge.rust-lang.org/infra/other-installation-methods.html )
Although the preferred way of installing Rust is by using rustup, as pointed out by the other posts, it is not uncommon to use the packages that your distro makes available.
I use, for example, the packages provided by Gentoo and I share the same problem about the not prefilled field for standard libraries.
Nevertheless, you can easily find out where your standard libraries have been installed by typing the following find command:
find /usr/lib* -type d -name "rust" | grep src
or the following if you installed rust in your home
find -type d -name "rust" | grep src
The previous commands will help, unless, of course, in your distro there is a package for the binaries and one for the source and you only installed the binary one.
I know the question is for MacOS but this answer is shown up when searching for it on Linux. Below I will answer for Ubuntu.
The path is /usr/lib/rustlib/src/rust/src for Ubuntu 20.04
The way I did is:
Installed rustc from the repositories, which includes cargo
sudo apt install rustc
Then installed rust source package
sudo apt install rust-src
I used apt-file (can be installed with sudo apt install apt-file) to search for the install path of the sources
sudo apt-file update
apt-file list rust-src
This show the path as /usr/src/rustc-1.41.0/src .
But a ls -la in /usr/lib/rustlib/ will reveal symlinks and /usr/lib/rustlib/src/rust/src points to the previous found directory.
Using the symlink on IntelliJ will survive new rust versions.
For Fedora 32 install Rust using command:
dnf install cargo rust-src
and the path to standard libary source is:
/usr/lib/rustlib/src/rust
I used Ubuntu. I follow these steps:
sudo apt install rust-src
wait for the install, then
dpkg -L rust-src
copy the last line. For me it is the standard library path:
/usr/lib/rustlib/src/rust
For MacOS, you need to put /opt/homebrew/bin/.

Why is no package 'mono' found?

Attempting to install Banshee from source on a CentOS 7 machine (migrating from Ubuntu and I want to retain my playlists and settings).
./configure results in:
configure: error: Package requirements (mono >= 2.4.3) were not met:
No package 'mono' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables MONO_MODULE_CFLAGS
and MONO_MODULE_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
which mono
/bin/mono
echo $PKG_CONFIG_PATH
/usr/local/lib/pkgconfig
but if I check for pkgconfig,
which pkgconfig
/usr/bin/which: no pkgconfig in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
yum provides pkgconfig
1:pkgconfig-0.27.1-4.el7.i686 : A tool for determining compilation options
Repo : base
yum install pkgconfig
Package 1:pkgconfig-0.27.1-4.el7.x86_64 already installed and latest version
A similar question was asked last year with no accepted answer. One of the answers pointed to a now non-existent page with a purported solution.
I believe pkg-config itself is working all right, configure is not complaining about that. What's missing is the entry for mono in the pkg-config database. Make sure you have mono.pc in /usr/local/lib/pkgconfig, or add wherever you have this file to PKG_CONFIG_PATH as instructed. On some linux distributions, development packages need to be separately installed, such as libmono-cil-dev on debian.