Why can't I cabal install template-haskell-2.17.0.0? - haskell

I am trying to install the specific version template-haskell-2.17.0.0. I run this command, but get an error during dependency resolution:
❯ cabal install template-haskell-2.17.0.0 --lib
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] next goal: template-haskell (user goal)
[__0] rejecting: template-haskell-2.18.0.0 (constraint from user target
requires ==2.17.0.0)
[__0] rejecting: template-haskell-2.17.0.0 (constraint from user target
requires ==2.16.0.0)
[__0] rejecting: template-haskell-2.16.0.0/installed-2.16.0.0,
template-haskell-2.16.0.0, template-haskell-2.15.0.0,
template-haskell-2.14.0.0, template-haskell-2.13.0.0,
template-haskell-2.12.0.0, template-haskell-2.11.1.0,
template-haskell-2.11.0.0, template-haskell-2.10.0.0,
template-haskell-2.9.0.0, template-haskell-2.8.0.0, template-haskell-2.7.0.0,
template-haskell-2.6.0.0, template-haskell-2.5.0.0, template-haskell-2.4.0.1,
template-haskell-2.4.0.0, template-haskell-2.3.0.1, template-haskell-2.3.0.0,
template-haskell-2.2.0.0 (constraint from user target requires ==2.17.0.0)
[__0] fail (backjumping, conflict set: template-haskell)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: template-haskell
I'm using the latest cabal version:
❯ cabal --version
cabal-install version 3.6.2.0
compiled using version 3.6.3.0 of the Cabal library

Some packages come with GHC and cannot be reinstalled. These are known as "boot" packages. The template-haskell package is one of these boot packages. You can find a complete list of them here: https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history.
For your particular case, template-haskell-2.17.0.0 is part of GHC 9.0.2 (or 9.0.1). The only way to install that version of template-haskell is to use the appropriate version of GHC.
Based on the error output, I'm guessing that you're using some version of GHC 8.10.x, probably 8.10.7. You don't mention how you installed GHC, so I don't know exactly how to tell you to upgrade. If you used GHCup, then you should be able to upgrade GHC with this command:
ghcup install ghc 9.0.2 --set

Related

cabal build fails with (conflict: requires GHC2021) it's unclear what this is?

cabal build myproject
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] next goal: plutarch (user goal)
[__0] rejecting: plutarch-1.3.0 (conflict: requires GHC2021)
[__0] fail (backjumping, conflict set: plutarch)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: plutarch
I'm running into the above error (conflict: requires GHC2021) however it is not clear what this is? It does not seem to be a package? There is various mentions of GHC2021 in a web search but I still don't understand what this conflict is?
https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/control.html seems to indicate it is a language spec, but I'm not sure where this should perhaps be specified?
More info:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.0.2
$ cabal --version
cabal-install version 3.4.0.0
compiled using version 3.4.0.0 of the Cabal library
cabal.project:
packages: myproject/
source-repository-package
type: git
location: https://github.com/Plutonomicon/plutarch-plutus.git
tag: 01a67f56b2bf428538e92ed9ada0ce88d90ab636
Fixed when updating GHC to 9.4.3 and cabal to 3.6.2.

Cabal: Can't install a specific version of the package (with message "only already installed instances can be used")

I've been trying to install some package:
PS C:\Users\Neo> cabal install template-haskell-2.15.0.0
Resolving dependencies...
cabal-3.6.2.0.exe: Could not resolve dependencies:
[__0] next goal: template-haskell (user goal)
[__0] rejecting: template-haskell-2.19.0.0, template-haskell-2.18.0.0,
template-haskell-2.17.0.0, template-haskell-2.16.0.0 (constraint from user
target requires ==2.15.0.0)
[__0] rejecting: template-haskell-2.15.0.0 (only already installed instances
can be used)
[__0] rejecting: template-haskell-2.14.0.0, template-haskell-2.13.0.0,
template-haskell-2.12.0.0, template-haskell-2.11.1.0,
template-haskell-2.11.0.0, template-haskell-2.10.0.0,
template-haskell-2.9.0.0, template-haskell-2.8.0.0, template-haskell-2.7.0.0,
template-haskell-2.6.0.0, template-haskell-2.5.0.0, template-haskell-2.4.0.1,
template-haskell-2.4.0.0, template-haskell-2.3.0.1, template-haskell-2.3.0.0,
template-haskell-2.2.0.0 (constraint from user target requires ==2.15.0.0)
[__0] fail (backjumping, conflict set: template-haskell)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: template-haskell
What does the message "only already installed instances can be used" actually mean?
Unlike most packages, template-haskell can't be installed, upgraded, or downgraded separately from GHC. If you really need to downgrade to template-haskell-2.15.0.0, then you need to downgrade to GHC 8.8.4. https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history has a chart that lets you check which GHC version corresponds to which library versions.

Trouble installing hsdev on windows to use SublimeHaskell with SublimeText

I have been trying to install the SublimeHaskell package for SublimeText and every time I open SublimeText I get a popup error message saying:
Backend configuration: "Local hsdev"
Incompatible hsdev, detected version 0.0.0.0
Version should be >= 0.3.3.0 and < 0.3.4.0
I therefore tried running the command: cabal install hsdev and I get the following error
C:\WINDOWS\system32>cabal install hsdev
Warning: The package list for 'hackage.haskell.org' is 24 days old.
Run 'cabal update' to get the latest list of available packages.
Warning: The package list for 'hackage.haskell.org' is 24 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
cabal.exe: Could not resolve dependencies:
[__0] trying: hsdev-0.3.3.8 (user goal)
[__1] next goal: template-haskell (dependency of hsdev)
[__1] rejecting: template-haskell-2.16.0.0/installed-2.16.0.0 (conflict: hsdev
=> template-haskell>=2.11.0 && <2.16)
[__1] skipping: template-haskell-2.16.0.0 (has the same characteristics that
caused the previous version to fail: excluded by constraint '>=2.11.0 &&
<2.16' from 'hsdev')
[__1] rejecting: template-haskell-2.15.0.0, template-haskell-2.14.0.0,
template-haskell-2.13.0.0, template-haskell-2.12.0.0,
template-haskell-2.11.1.0, template-haskell-2.11.0.0,
template-haskell-2.10.0.0, template-haskell-2.9.0.0, template-haskell-2.8.0.0,
template-haskell-2.7.0.0, template-haskell-2.6.0.0, template-haskell-2.5.0.0,
template-haskell-2.4.0.1, template-haskell-2.4.0.0, template-haskell-2.3.0.1,
template-haskell-2.3.0.0, template-haskell-2.2.0.0 (constraint from
non-upgradeable package requires installed instance)
[__1] fail (backjumping, conflict set: hsdev, template-haskell)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: ghc-mod, hsdev, hlint,
haskell-src-exts, base, template-haskell
Try running with --minimize-conflict-set to improve the error message.
I've tried re-installing cabal and it still won't let me download hsdev (I'm on a windows machine and installed the Haskell Platform using chocolatey), any suggestions?
cabal-install version 3.2.0.0
The Glorious Glasgow Haskell Compilation System, version 8.10.2

Whenever I try to install a new package on Cabal, it tries and fails to install a previously failed install

In the past I tried to install Clipboard via Cabal, unknowing it only works on 32-bit Windows, so it failed. Now, I'm trying to install utf8-string via Cabal, but when I run the command cabal new-install utf8-string I get the following:
Resolving dependencies...
cabal.exe: Could not resolve dependencies:
[__0] trying: Clipboard-2.3.2.0 (user goal)
[__1] next goal: Win32 (dependency of Clipboard)
[__1] rejecting: Win32-2.6.1.0/installed-2.6..., 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 (conflict:
Clipboard => Win32>=2.2.0.0 && <2.4)
[__1] trying: Win32-2.3.1.1
[__2] trying: base-4.12.0.0/installed-4.1... (user goal)
[__3] next goal: ghc (user goal)
[__3] rejecting: ghc-8.6.5/installed-8.6... (conflict: Win32==2.3.1.1, ghc =>
Win32==2.6.1.0/installed-2.6...)
[__3] rejecting: ghc-8.6.5 (conflict: base==4.12.0.0/installed-4.1..., ghc =>
base<0 && ==4.12.*)
[__3] rejecting: ghc-8.6.4, ghc-8.6.1, ghc-8.4.4, ghc-8.4.3, ghc-8.4.1,
ghc-8.2.2, ghc-8.2.1 (constraint from user target requires ==8.6.5)
[__3] fail (backjumping, conflict set: Win32, base, ghc)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: ghc, Win32, base, Clipboard
In case it's important, I'm running Windows 10 64-bit, and I'm using Cygwin64 Terminal.
Cabal Dependency Failure: A story of two tools
You: Cabal! Install something old.
Cabal: Can do. And for my buddy GHC I will also record this something old in $HOME/.ghc/$arch-$ghc_version/environments/default.
You: Cabal! Install something else.
Cabal: Ok. Let me check what packages I should install for that. Yeah now I have that list... it says here I should install new thing - but an old version of new thing is mandated by the default environment.
Finding your way out
The Terminator
Screw the old environment, I don't care.
rm $HOME/.ghc/*/environments/default
The Librarian
I like my old environment, let's build this package with a new environment.
cabal install --package-env some-new-named-package-environment utf8-string
The Programmer
I like directory-based workflows and don't really want to think about environments, how about you think about that for me, cabal.
cabal install --lib utf8-string --package-env .
The Programmer (Summer 2020, I hope)
I like directory-based workflows and don't want to talk about environments. Luckily someone fixed the underlying issue https://github.com/haskell/cabal/issues/5559 so now I can just type cabal install --lib utf8-string.

yesod with stackage is failing to install due to dependency problems

I tried to set up a yesod project as follows:
mkdir sample_blog
curl -o cabal.config www.stackage.org/nightly/cabal.config
cabal install alex happy yesod-bin
However, I got the following error:
Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: Cabal (user goal)
rejecting: Cabal-1.18.1.4/installed-d6c... (global constraint requires
==1.18.1.3)
trying: Cabal-1.18.1.3/installed-476...
trying: yesod-bin-1.4.2 (user goal)
next goal: ghc (dependency of yesod-bin-1.4.2)
rejecting: ghc-7.8.3/installed-1d5... (conflict:
Cabal==1.18.1.3/installed-476..., ghc => Cabal==1.18.1.4/installed-d6c...)
Dependency tree exhaustively searched.
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.
I've install GHC and cabal-install using homebrew.
Versions:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.3
$ cabal --version
cabal-install version 1.20.0.4
using version 1.20.0.3 of the Cabal library
It appears that homebrew has patched the standard GHC installation, as it's shipping with a different version of the Cabal library than the official GHC. I don't know why that is occurring. A quick workaround would be to remove the Cabal line from your cabal.config. Can you open up an issue against Stackage about this? I'd like to get to the bottom of why this is occurring.

Resources