Giter VIP home page Giter VIP logo

cabal-edit's People

Contributors

phadej avatar sdiehl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cabal-edit's Issues

Cannot detect cabal on Windows

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)

Incorrect upper bounds generated

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

let ver' = majorUpperBound latestVer
(computing the new version to pass to upgrade - note that majorUpperBound computes the next-greater major version - and
upgrade pk latest (_, cabalFile) =
&
let ver' = intersectVersionRanges (orLaterVersion prev) (orEarlierVersion latest)
where the 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 fails due to missing `AnyVersion`, `WildcardVersion`, ...

Summary

cabal install cabal-edit fails with missing identifiers

Haskell info

(fetched using ghcup tui)

GHC 9.0.2
cabal 3.8.1.0

Build Log

❯ 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.

System info

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.