Async library not present after installation - haskell

I'm trying to install async and it's proving to be an awful venture! I try to install it through cabal with the command cabal install async.
This gives me the error:
~/Desktop : cabal install async
Resolving dependencies...
Up to date
Warning: You asked to install executables, but there are no executables in
target: async. Perhaps you want to use --lib to install libraries instead.
Installing now with the command cabal install async --lib gives me the error :
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] next goal: base (user goal)
[__0] rejecting: base-4.14.1.0, base-4.14.0.0 (constraint from user target
requires ==4.13.0.0)
[__0] trying: base-4.13.0.0/installed-4.13.0.0
[__1] next goal: ghc (user goal)
[__1] rejecting: ghc-8.10.2, ghc-8.10.1 (constraint from user target requires
==8.8.3)
[__1] trying: ghc-8.8.3/installed-8.8.3
[__2] next goal: process (user goal)
[__2] rejecting: process-1.6.11.0 (constraint from user target requires
==1.6.10.0)
[__2] rejecting: process-1.6.10.0 (conflict: ghc =>
process==1.6.8.0/installed-1.6.8.0)
[__2] rejecting: process-1.6.9.0, process-1.6.8.2, process-1.6.8.1,
process-1.6.8.0/installed-1.6.8.0, process-1.6.8.0, process-1.6.7.0,
process-1.6.6.0, process-1.6.5.1, process-1.6.5.0, process-1.6.4.0,
process-1.6.3.0, process-1.6.2.0, process-1.6.1.0, process-1.6.0.0,
process-1.5.0.0, process-1.4.3.0, process-1.4.2.0, process-1.4.1.0,
process-1.4.0.0, process-1.3.0.0, process-1.2.3.0, process-1.2.2.0,
process-1.2.1.0, process-1.2.0.0, process-1.1.0.2, process-1.1.0.1,
process-1.1.0.0, process-1.0.1.5, process-1.0.1.4, process-1.0.1.3,
process-1.0.1.2, process-1.0.1.1, process-1.0.0.0 (constraint from user target
requires ==1.6.10.0)
[__2] fail (backjumping, conflict set: ghc, process)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: process, ghc, base
My process, ghc, and base are incompatible. I'm presuming it's because of the version constraints but when I try to install the package through the following commands, I get this message:
cabal get async
cd async-2.2.3
cabal build
Resolving dependencies...
Build profile: -w ghc-8.8.3 -O1
In order, the following will be built (use -v for more details):
- async-2.2.3 (lib) (first run)
Configuring library for async-2.2.3..
Preprocessing library for async-2.2.3..
Building library for async-2.2.3..
[1 of 1] Compiling Control.Concurrent.Async ( Control/Concurrent/Async.hs, /Users/edward/Desktop/lsy/Olivia/async-2.2.3/dist-newstyle/build/x86_64-osx/ghc-8.8.3/async-2.2.3/build/Control/Concurrent/Async.o )
Control/Concurrent/Async.hs:215:1: warning: [-Wunused-imports]
The import of ‘Data.Semigroup’ is redundant
except perhaps to import instances from ‘Data.Semigroup’
To import instances alone, use: import Data.Semigroup()
|
215 | import Data.Semigroup (Semigroup((<>)))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When I go to actually import the library now, it says that its hidden and that the only way I can use it is if I expose but to expose it, I can only use the package within ghci rather than in programs such as those found here https://www.fpcomplete.com/haskell/library/async/
If it was able to build the library, shouldn't I "have" the library?

Related

How to handle following dependency conflict in Cabal?

When I try to add scotty package to my multi-project cabal file, I get following dependency conflict. I am not exactly sure what it means.
harshal#Harshals-Linux hello-haskell % cabal build
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] trying: playground-0.1.0.0 (user goal)
[__1] trying: scotty-0.12.1 (dependency of playground)
[__2] trying: warp-3.3.23 (dependency of scotty)
[__3] trying: unix-compat-0.6 (dependency of warp)
[__4] trying: unix-2.7.3/installed-2.7.3 (dependency of warp)
[__5] next goal: directory (dependency of playground)
[__5] rejecting: directory-1.3.7.1/installed-1.3.7.1 (conflict: playground =>
directory>=1.3.8.0)
[__5] rejecting: directory-1.3.8.0 (conflict: unix==2.7.3/installed-2.7.3,
directory => unix>=2.8.0 && <2.9)
[__5] rejecting: directory-1.3.7.1 (conflict: playground =>
directory>=1.3.8.0)
[__5] skipping: directory-1.3.7.0, directory-1.3.6.2, directory-1.3.6.1,
directory-1.3.6.0, directory-1.3.5.0, directory-1.3.4.0, directory-1.3.3.2,
directory-1.3.3.1, directory-1.3.3.0, directory-1.3.2.2, directory-1.3.2.1,
directory-1.3.2.0, directory-1.3.1.5, directory-1.3.1.4, directory-1.3.1.3,
directory-1.3.1.2, directory-1.3.1.1, directory-1.3.1.0, directory-1.3.0.2,
directory-1.3.0.1, directory-1.3.0.0, directory-1.2.7.1, directory-1.2.7.0,
directory-1.2.6.3, directory-1.2.6.2, directory-1.2.5.1, directory-1.2.5.0,
directory-1.2.4.0, directory-1.2.3.1, directory-1.2.3.0, directory-1.2.2.1,
directory-1.2.2.0, directory-1.2.1.0, directory-1.2.0.1, directory-1.2.0.0,
directory-1.1.0.2, directory-1.1.0.1, directory-1.1.0.0, directory-1.0.1.2,
directory-1.0.1.1, directory-1.0.1.0, directory-1.0.0.3, directory-1.0.0.0,
directory-1.2.6.1 (has the same characteristics that caused the previous
version to fail: excluded by constraint '>=1.3.8.0' from 'playground')
[__5] fail (backjumping, conflict set: directory, playground, unix)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: directory, unix, playground,
unix-compat, warp, unix-compat:portable, scotty
Try running with --minimize-conflict-set to improve the error message.
How can I resolve this dependency conflict?
What this says:
playground-0.1.0.0 depends on directory >= 1.3.8.0
directory-1.3.8.0 is the only apparent solution to directory >= 1.3.8.0
directory-1.3.8.0 depends on unix >= 2.8.0 && <2.9
we already committed to unix==2.7.3, which does not satisfy that constraint
One thing you could try, therefore, is to give it a hint that you want to pick a newer unix, by adding a top-level constraint:
% cabal build --constraint `unix >=2.8.0 && <2.9`
Top-level constraints are "available" earlier than constraints found via searching for dependencies, and so can constrain earlier choices better. (I believe this property -- that constraints get solved and committed to in some not-totally-user-visible order -- is to make the dependency resolution algorithm more efficient. Bummer.)

Cabal install error with conflicting constraints

So right now I'm trying to run cabal install --lib bytestring, seems simple enough. But every time I run this I get this error message:
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] next goal: bytestring (user goal)
[__0] rejecting: bytestring-0.11.3.1, bytestring-0.11.3.0,
bytestring-0.11.2.0, bytestring-0.11.1.0, bytestring-0.11.0.0,
bytestring-0.10.12.1 (constraint from user target requires ==0.10.12.0)
[__0] rejecting: bytestring-0.10.12.0/installed-0.10.12.0,
bytestring-0.10.12.0 (constraint from user target requires ==0.11.3.1)
[__0] rejecting: bytestring-0.10.10.1, bytestring-0.10.10.0,
bytestring-0.10.9.0, bytestring-0.10.8.2, bytestring-0.10.8.1,
bytestring-0.10.8.0, bytestring-0.10.6.0, bytestring-0.10.4.1,
bytestring-0.10.4.0, bytestring-0.10.2.0, bytestring-0.10.0.2,
bytestring-0.10.0.1, bytestring-0.10.0.0, bytestring-0.9.2.1,
bytestring-0.9.2.0, bytestring-0.9.1.10, bytestring-0.9.1.9,
bytestring-0.9.1.8, bytestring-0.9.1.7, bytestring-0.9.1.6,
bytestring-0.9.1.5, bytestring-0.9.1.4, bytestring-0.9.1.3,
bytestring-0.9.1.2, bytestring-0.9.1.1, bytestring-0.9.1.0,
bytestring-0.9.0.4, bytestring-0.9.0.3, bytestring-0.9.0.2,
bytestring-0.9.0.1, bytestring-0.9 (constraint from user target requires
==0.10.12.0)
[__0] fail (backjumping, conflict set: bytestring)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: bytestring
It appears that cabal has conflicting constraints that prevent it from installing 0.10.12.0 or 0.11.3.1 (fyi: i'm trying to use 0.10.12.0). How can I remove the "version==0.11.3.1" constraint? ty.

Why does omitting cabal-version cause the build to fail?

I have a minimal example project:
Test
Test
Test.hs
Test.cabal
Test.hs contains an empty module Test.Test. The contents of Test.cabal are as follows:
name: Test
version: 0.0.0
library
build-depends: base
exposed-modules: Test.Test
Running cabal build fails with a long, confusing error message (copied below) unless I add cabal-version: 2.2 to the cabal file. Higher than 2.2 works as well but lower versions result in a similar error. My cabal version is 3.2. Why does the build fail unless I specify a cabal version and why are versions lower than 2.2 not sufficient?
The error message that I get without specifying cabal version is as follows:
Resolving dependencies...
cabal.exe: Could not resolve dependencies:
[__0] trying: Test-0.0.0 (user goal)
[__1] next goal: Test:setup.Cabal (dependency of Test)
[__1] rejecting: Test:setup.Cabal-3.2.0.0/installed-3.2.0.0 (conflict: Test =>
Test:setup.Cabal>=0 && <1.25)
[__1] skipping: Test:setup.Cabal-3.6.3.0, Test:setup.Cabal-3.6.2.0,
Test:setup.Cabal-3.6.1.0, Test:setup.Cabal-3.6.0.0, Test:setup.Cabal-3.4.1.0,
Test:setup.Cabal-3.4.0.0, Test:setup.Cabal-3.2.1.0, Test:setup.Cabal-3.2.0.0,
Test:setup.Cabal-3.0.2.0, Test:setup.Cabal-3.0.1.0, Test:setup.Cabal-3.0.0.0,
Test:setup.Cabal-2.4.1.0, Test:setup.Cabal-2.4.0.1, Test:setup.Cabal-2.4.0.0,
Test:setup.Cabal-2.2.0.1, Test:setup.Cabal-2.2.0.0, Test:setup.Cabal-2.0.1.1,
Test:setup.Cabal-2.0.1.0, Test:setup.Cabal-2.0.0.2 (has the same
characteristics that caused the previous version to fail: excluded by
constraint '>=0 && <1.25' from 'Test')
[__1] rejecting: Test:setup.Cabal-1.24.2.0, Test:setup.Cabal-1.24.0.0,
Test:setup.Cabal-1.22.8.0, Test:setup.Cabal-1.22.7.0,
Test:setup.Cabal-1.22.6.0, Test:setup.Cabal-1.22.5.0,
Test:setup.Cabal-1.22.4.0, Test:setup.Cabal-1.22.3.0,
Test:setup.Cabal-1.22.2.0, Test:setup.Cabal-1.22.1.1,
Test:setup.Cabal-1.22.1.0, Test:setup.Cabal-1.22.0.0,
Test:setup.Cabal-1.20.0.4, Test:setup.Cabal-1.20.0.3,
Test:setup.Cabal-1.20.0.2, Test:setup.Cabal-1.20.0.1,
Test:setup.Cabal-1.20.0.0, Test:setup.Cabal-1.18.1.7,
Test:setup.Cabal-1.18.1.6, Test:setup.Cabal-1.18.1.5,
Test:setup.Cabal-1.18.1.4, Test:setup.Cabal-1.18.1.3,
Test:setup.Cabal-1.18.1.2, Test:setup.Cabal-1.18.1.1, Test:setup.Cabal-1.18.1,
Test:setup.Cabal-1.18.0, Test:setup.Cabal-1.16.0.3, Test:setup.Cabal-1.16.0.2,
Test:setup.Cabal-1.16.0.1, Test:setup.Cabal-1.16.0, Test:setup.Cabal-1.14.0,
Test:setup.Cabal-1.12.0, Test:setup.Cabal-1.10.2.0, Test:setup.Cabal-1.10.1.0,
Test:setup.Cabal-1.10.0.0, Test:setup.Cabal-1.8.0.6, Test:setup.Cabal-1.8.0.4,
Test:setup.Cabal-1.8.0.2, Test:setup.Cabal-1.6.0.3, Test:setup.Cabal-1.6.0.2,
Test:setup.Cabal-1.6.0.1, Test:setup.Cabal-1.4.0.2, Test:setup.Cabal-1.4.0.1,
Test:setup.Cabal-1.4.0.0, Test:setup.Cabal-1.2.4.0, Test:setup.Cabal-1.2.3.0,
Test:setup.Cabal-1.2.2.0, Test:setup.Cabal-1.2.1, Test:setup.Cabal-1.1.6,
Test:setup.Cabal-1.24.1.0 (constraint from minimum version of Cabal used by
Setup.hs requires >=3.2)
[__1] fail (backjumping, conflict set: Test, Test:setup.Cabal)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: Test:setup.Cabal, Test

Dificoulties installing gloss and other packages with cabal

I am trying to install gloss but, I dont know why ghci doesn't find the modules.
When I do cabal install gloss it says:
Up to date
Warning: You asked to install executables, but there are no executables in
target: gloss. Perhaps you want to use --lib to install libraries instead.
When I do cabal install -lib gloss it gives me thies error:
Resolving dependencies...
cabal.exe: Could not resolve dependencies:
[__0] trying: bytestring-0.11.0.0 (user goal)
[__1] next goal: directory (user goal)
[__1] rejecting: directory-1.3.6.1 (constraint from user target requires
==1.3.6.0)
[__1] trying: directory-1.3.6.0/installed-1.3.6.0
[__2] next goal: Win32 (dependency of directory)
[__2] rejecting: Win32-2.6.1.0/installed-2.6.1.0 (conflict:
bytestring==0.11.0.0, Win32 => bytestring==0.10.10.0/installed-0.10.10.0)
[__2] rejecting: Win32-2.10.1.0, Win32-2.10.0.0, Win32-2.9.0.0, Win32-2.8.5.0,
Win32-2.8.4.0, Win32-2.8.3.0, Win32-2.8.2.0, Win32-2.8.1.0, Win32-2.8.0.0,
Win32-2.7.0.0, Win32-2.6.2.0, Win32-2.6.1.0, Win32-2.6.0.0, Win32-2.5.4.1,
Win32-2.5.3.0, Win32-2.5.2.0, Win32-2.5.1.0, Win32-2.5.0.0, Win32-2.4.0.0,
Win32-2.3.1.1, Win32-2.3.1.0, Win32-2.3.0.2, Win32-2.3.0.1, Win32-2.3.0.0,
Win32-2.2.2.0, Win32-2.2.1.0, Win32-2.2.0.2, Win32-2.2.0.1, Win32-2.2.0.0,
Win32-2.1.0.0, Win32-2.1, Win32-2.5.4.0 (conflict: directory =>
Win32==2.6.1.0/installed-2.6.1.0)
[__2] fail (backjumping, conflict set: Win32, bytestring, directory)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: ghc, bytestring, Win32, directory
Try running with --minimize-conflict-set to improve the error message.
This is very strange because the firs time I used this command it worked perfectly but then when I tried to do on ghci ´´´import ...´´´ it sayd: Module not found.
I have tried other modules and it gives me the same error. I thought that the issue could be that ghc is not able to search in the cabal folder where the packages are saved but I am no longer sure.
How can I fix this? Thanks

Trouble cabal installing http-conduit

When I run cabal install http-conduit, I get the following:
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: base-4.12.0.0/installed-4.1... (user goal)
[__1] trying: ghc-8.6.5/installed-8.6... (user goal)
[__2] next goal: process (user goal)
[__2] rejecting: process-1.6.7.0 (constraint from user target requires
==1.6.6.0)
[__2] rejecting: process-1.6.6.0 (conflict: ghc =>
process==1.6.5.0/installed-1.6...)
[__2] rejecting: process-1.6.5.1, process-1.6.5.0/installed-1.6...,
process-1.6.5.0, process-1.6.4.0, process-1.6.3.0, process-1.6.2.0,
process-1.6.1.0, process-1.6.0.0, process-1.5.0.0, process-1.4.3.0,
process-1.4.2.0, process-1.4.1.0, process-1.4.0.0, process-1.3.0.0,
process-1.2.3.0, process-1.2.2.0, process-1.2.1.0, process-1.2.0.0,
process-1.1.0.2, process-1.1.0.1, process-1.1.0.0, process-1.0.1.5,
process-1.0.1.4, process-1.0.1.3, process-1.0.1.2, process-1.0.1.1,
process-1.0.0.0 (constraint from user target requires ==1.6.6.0)
[__2] fail (backjumping, conflict set: ghc, process)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: process, base, ghc
I'm running cabal v3.0.0.0 and ghc v8.6.5
I'm quite new to the Haskell ecosystem, so any help I could get would be greatly appreciated. Thanks!
It looks like you have a dependency conflict, one package requires a different version than the package you are trying to install. This can be very difficult to solve for new users.
If you are new to Haskell and want to start using dependencies from Hackage, the centralized package archive for Haskell, I recommend using stack (install instructions and basic workflow. stack is a tool built on top of cabal that includes a curated list of package versions that are compatible. It should make it easier for you to get started.

Resources