sdiehl / cabal-edit Goto Github PK
View Code? Open in Web Editor NEWA utility for managing Hackage dependencies and manipulating Cabal files from the command line.
License: MIT License
A utility for managing Hackage dependencies and manipulating Cabal files from the command line.
License: MIT License
When I am using cabal-edit on windows, it reported the following error message.
$ cabal-edit --version
No ~/.cabal directory found. Is cabal installed?
I had my Cabal and GHC properly installed.
$ cabal --version
cabal-install version 3.2.0.0
compiled using version 3.2.0.0 of the Cabal library.
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.2
This may be a problem with this line.
It attempts to find cabal files in $HOME/.cabal
but in Windows Cabal save its files to %APPDATA%\cabal
which is the result of getAppUserDataDirectory "cabal"
on Windows system. (Reference)
Consider the following sequence of commands
cabal-edit latest optics
: says the latest is optics ^>= 0.4
cabal-edit add optics
: adds the dependency optics ^>= 0.4
cabal-edit update optics
: changes the dependency to optics >=0.4 && <=0.5
(Note the use of <=
here)There two things to note here. A minor distraction is that upgrading an up-to-date package changed the cabal file. The much more important thing is that this upper bound is incorrect!
This claims we will be compatible with an as-yet-unreleased new major version of optics
. I don't think that this is what the version bound should be. I expect I should have either of
optics >=0.4 && <0.5
, (which is equivalent to the original bound). This says "compatible until the next major version bump".optics >=0.4 && <=0.4
(I chose a bad example here, for a current dependency of dep ^>= 1.2.3.4
and a newer version of 1.7.8.9
we would get dep >=1.2.3.4 && <= 1.7.8.9
). This says "compatible with the currently-released version, but maybe not anything later, even minor/patch releases".I think the confusion in the code is between
Line 387 in 3e509ba
upgrade
- note that majorUpperBound
computes the next-greater major version - and Line 168 in 3e509ba
Line 205 in 3e509ba
upgrade
function seems to use it as the latest
version (thus putting a <=
bound).
I think the fix should be straightforward and am willing to send a PR once it is clear which of the two options would be preferable. (Note to self: potentially is worth adding a lint pass to detect a <=
bound on a non-existing version number?)
cabal install cabal-edit
fails with missing identifiers
(fetched using ghcup tui
)
GHC 9.0.2
cabal 3.8.1.0
❯ cabal install cabal-edit Resolving dependencies... Build profile: -w ghc-9.0.2 -O1 In order, the following will be built (use -v for more details): - cabal-edit-0.1.0.0 (exe:cabal-edit) (requires build) Starting cabal-edit-0.1.0.0 (exe:cabal-edit) Building cabal-edit-0.1.0.0 (exe:cabal-edit)Failed to build exe:cabal-edit from cabal-edit-0.1.0.0.
Build log (
/home/scarf/.cabal/logs/ghc-9.0.2/cabal-edit-0.1.0.0-e-cabal-edit-72fad4d31d4f26d321ac6d7854c9e7b56681fc85aac1b3221636deb58a1b5514.log
):
Configuring executable 'cabal-edit' for cabal-edit-0.1.0.0..
Preprocessing executable 'cabal-edit' for cabal-edit-0.1.0.0..
Building executable 'cabal-edit' for cabal-edit-0.1.0.0..
[1 of 1] Compiling Main ( exe/Main.hs, dist/build/cabal-edit/cabal-edit-tmp/Main.o )exe/Main.hs:146:5: error:
Not in scope: data constructor ‘AnyVersion’
Perhaps you meant one of these:
variable ‘anyVersion’ (imported from Distribution.Types.VersionRange.Internal),
variable ‘noVersion’ (imported from Distribution.Types.VersionRange.Internal),
variable ‘mkVersion’ (imported from Distribution.Types.Version)
|
146 | AnyVersion -> do
| ^^^^^^^^^^exe/Main.hs:160:5: error:
Not in scope: data constructor ‘WildcardVersion’
|
160 | WildcardVersion givenVersion -> addVer WildcardVersion givenVersion (fname, cabalFile) dep
| ^^^^^^^^^^^^^^^exe/Main.hs:188:9: error:
Not in scope: data constructor ‘AnyVersion’
Perhaps you meant one of these:
variable ‘anyVersion’ (imported from Distribution.Types.VersionRange.Internal),
variable ‘noVersion’ (imported from Distribution.Types.VersionRange.Internal),
variable ‘mkVersion’ (imported from Distribution.Types.Version)
|
188 | AnyVersion -> replaceVersion dep
| ^^^^^^^^^^exe/Main.hs:189:9: error:
Not in scope: data constructor ‘WildcardVersion’
|
189 | WildcardVersion _ -> replaceVersion dep
| ^^^^^^^^^^^^^^^exe/Main.hs:193:9: error:
Not in scope: data constructor ‘VersionRangeParens’
Perhaps you meant variable ‘versionRangeParser’ (imported from Distribution.Types.VersionRange.Internal)
|
193 | VersionRangeParens _ -> replaceVersion dep
| ^^^^^^^^^^^^^^^^^^exe/Main.hs:296:5: error:
Not in scope: data constructor ‘AnyVersion’
Perhaps you meant one of these:
variable ‘anyVersion’ (imported from Distribution.Types.VersionRange.Internal),
variable ‘noVersion’ (imported from Distribution.Types.VersionRange.Internal),
variable ‘mkVersion’ (imported from Distribution.Types.Version)
|
296 | AnyVersion -> putStrLn $ prettyShow pk ++ " : " ++ "Wildcard version detected. Instead use explicit version bounds."
| ^^^^^^^^^^exe/Main.hs:308:5: error:
Not in scope: data constructor ‘WildcardVersion’
|
308 | WildcardVersion ver ->
| ^^^^^^^^^^^^^^^exe/Main.hs:324:5: error:
Not in scope: data constructor ‘VersionRangeParens’
Perhaps you meant variable ‘versionRangeParser’ (imported from Distribution.Types.VersionRange.Internal)
|
324 | VersionRangeParens _ -> pure ()
| ^^^^^^^^^^^^^^^^^^
Error: cabal: Failed to build exe:cabal-edit from cabal-edit-0.1.0.0. See the
build log above for details.
Operating System: Kubuntu 22.04 KDE Plasma Version: 5.24.6 KDE Frameworks Version: 5.95.0 Qt Version: 5.15.3 Kernel Version: 5.15.0-47-generic (64-bit) Graphics Platform: X11 Processors: 8 × AMD Ryzen 7 4700U with Radeon Graphics Memory: 30.7 GiB of RAM Graphics Processor: AMD RENOIR
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.